mirror of
https://github.com/audacity/audacity-actions.git
synced 2025-12-10 03:56:07 -06:00
Actions refactored to simplify further work
This commit is contained in:
parent
ce925b75ca
commit
e03c1ec0c5
@ -150,7 +150,7 @@ async function run() {
|
||||
await conan.uploadBinaries();
|
||||
await conan.cleanupConanBuilds();
|
||||
} catch(error) {
|
||||
helper.error(error.message);
|
||||
helpers.error(error.message);
|
||||
core.setFailed(error.message);
|
||||
} finally {
|
||||
if (saveCache) {
|
||||
@ -158,7 +158,7 @@ async function run() {
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
helper.error(error.message);
|
||||
helpers.error(error.message);
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
const md5 = require('md5');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
@ -31,10 +30,8 @@ async function getCompilerVersion(generator) {
|
||||
|
||||
async function getConanCacheKeys(generator) {
|
||||
const depsFile = path.join(workspaceDir, 'cmake-proxies/CMakeLists.txt');
|
||||
// Evaluate Conan cache key
|
||||
const depsContent = fs.readFileSync(depsFile);
|
||||
const depsMD5 = md5(depsContent);
|
||||
|
||||
const depsMD5 = helpers.getMD5(depsFile);
|
||||
|
||||
const conanVersion = await getConanVersion();
|
||||
|
||||
const conanCacheKeyShort = [
|
||||
|
||||
@ -2,6 +2,7 @@ const core = require('@actions/core');
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
const path = require('path');
|
||||
const md5 = require('md5');
|
||||
|
||||
const runningOnCI = process.env['CI']
|
||||
|
||||
@ -65,6 +66,21 @@ async function awaitAll(array, functor) {
|
||||
return await Promise.all(array.map(async (item) => functor(item)))
|
||||
}
|
||||
|
||||
async function getMD5(filePath) {
|
||||
const depsContent = await fs.promises.readFileSync(filePath);
|
||||
return md5(depsContent);
|
||||
}
|
||||
|
||||
function getDateString() {
|
||||
const currentDate = new Date();
|
||||
|
||||
return [
|
||||
currentDate.getFullYear(),
|
||||
('0' + (currentDate.getMonth() + 1)).slice(-2),
|
||||
('0' + currentDate.getDate()).slice(-2)
|
||||
].join('')
|
||||
}
|
||||
|
||||
const sleep = (waitTimeInMs) => new Promise(resolve => setTimeout(resolve, waitTimeInMs));
|
||||
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
@ -84,4 +100,6 @@ module.exports = {
|
||||
getExecOutput: getExecOutput,
|
||||
sleep: sleep,
|
||||
awaitAll: awaitAll,
|
||||
getMD5: getMD5,
|
||||
getDateString: getDateString,
|
||||
}
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
const core = require('@actions/core');
|
||||
const artifact = require('@actions/artifact');
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
@ -90,7 +89,7 @@ async function getBuildSuffix() {
|
||||
('0' + currentDate.getDate()).slice(-2)
|
||||
].join('')
|
||||
|
||||
const revision = (await exec.getExecOutput('git', ['show', '-s', '--format=%h'])).stdout.trim();
|
||||
const revision = (await helpers.getExecOutput('git', ['show', '-s', '--format=%h'])).stdout.trim();
|
||||
|
||||
return `-${BuildLevel.getBuildSuffix(buildLevel)}-${dateString}+${revision}`;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user