Add extension dependency support for Darwin

Refactor extension.sh to 3 scripts

Update dependencies

Minor fixes in cache.ts and tests

Improve get_api_version in cache.sh

Improve logs

Use @actions/cache to cache dependencies

Refactor linux.sh

Refactor Node.js code

Do not setup dependencies for old PHP

Remove duplicate dependency extensions in linux

Bump version to 1.6.0
This commit is contained in:
Shivam Mathur
2021-07-01 09:32:36 +05:30
parent b9734e30e3
commit 65ea75914e
13 changed files with 60512 additions and 1962 deletions

View File

@@ -1,8 +1,37 @@
import {exec} from '@actions/exec';
import * as cache from '@actions/cache';
import * as core from '@actions/core';
import * as path from 'path';
import * as utils from './utils';
/**
* Handle dependencies
*
* @param extensions
* @param version
*/
export async function handleDependencies(
extensions: string,
version: string
): Promise<void> {
if (!/^5.[3-5]$/.test(version) && /linux|darwin/.test(process.platform)) {
const cache_key: string = (await utils.getOutput('key')) + '-deps';
const cache_dir: string = path.join(
await utils.readEnv('RUNNER_TOOL_CACHE'),
'deps'
);
const cache_hit: string | undefined = await cache.restoreCache(
[cache_dir],
cache_key,
[cache_key]
);
await exec(await utils.scriptCall('dependencies', extensions, version));
if (!cache_hit) {
await cache.saveCache([cache_dir], cache_key);
}
}
}
/**
* Run the script
*/
@@ -15,14 +44,16 @@ export async function run(): Promise<void> {
await utils.getInput('extensions', true)
);
const key: string = await utils.getInput('key', true);
const script_path: string = path.join(__dirname, '../src/extensions.sh');
await exec(
'bash ' + script_path + ' "' + extensions + '" ' + key + ' ' + version
);
await exec(await utils.scriptCall('data', extensions, version, key));
await handleDependencies(extensions, version);
} catch (error) {
core.setFailed(error.message);
}
}
// call the run function
run();
(async () => {
await run();
})().catch(error => {
core.setFailed(error.message);
});