Skip to content

Commit

Permalink
Use local action in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
q-uint committed Jun 8, 2021
1 parent c5c0308 commit d28653a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: allusion-be/setup-dfx@main
- uses: ./
with:
dfx-version: 0.7.1
vessel-version: 0.6.1
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ name: 'Setup dfx environment'
description: 'Setup a dfx environment and add it to the PATH.'
inputs:
dfx-version:
required: true,
required: true
description: 'The dfx version to download.'
vessel-version:
description: 'The vessel version to download.'
install-moc:
description: 'Whether to install moc. Default is true.'
default: true
runs:
using: 'node12'
main: 'dist/index.js'
12 changes: 7 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ function run() {
core.debug(dfxPath);
infoExec(`${dfxPath} --version`);
// Install dfx cache to get moc.
child_process_1.default.execSync(`${dfxPath} cache install`);
let cachePath = infoExec(`${dfxPath} cache show`).trim();
core.addPath(cachePath);
let mocPath = yield io.which('moc');
infoExec(`${mocPath} --version`);
if (core.getBooleanInput('install-moc')) {
child_process_1.default.execSync(`${dfxPath} cache install`);
let cachePath = infoExec(`${dfxPath} cache show`).trim();
core.addPath(cachePath);
let mocPath = yield io.which('moc');
infoExec(`${mocPath} --version`);
}
// Install vessel.
let vesselVersion = core.getInput('vessel-version');
if (vesselVersion) {
Expand Down
12 changes: 7 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ export async function run() {
infoExec(`${dfxPath} --version`);

// Install dfx cache to get moc.
cp.execSync(`${dfxPath} cache install`);
let cachePath = infoExec(`${dfxPath} cache show`).trim();
core.addPath(cachePath);
if (core.getBooleanInput('install-moc')) {
cp.execSync(`${dfxPath} cache install`);
let cachePath = infoExec(`${dfxPath} cache show`).trim();
core.addPath(cachePath);

let mocPath = await io.which('moc');
infoExec(`${mocPath} --version`);
let mocPath = await io.which('moc');
infoExec(`${mocPath} --version`);
}

// Install vessel.
let vesselVersion = core.getInput('vessel-version');
Expand Down

0 comments on commit d28653a

Please sign in to comment.