Skip to content

Commit

Permalink
Add alt source for PocketIC.
Browse files Browse the repository at this point in the history
  • Loading branch information
q-uint committed Apr 28, 2024
1 parent 276f896 commit 8499faa
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
dfx-version: ${{ matrix.version }}
install-moc: true
vessel-version: 0.7.0
pocketic-version: 3.0.1
pocket-ic-version: release-2024-04-24_23-01-base
- run: |
dfx --version
moc --version
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
dfx-disable-encryption:
description: 'Whether to use the .pem encryption.'
default: "false"
pocketic-version:
pocket-ic-version:
description: 'The pocket ic version to download. If empty pocket ic will not be installed.'
install-moc:
description: 'Whether to install moc through dfx.'
Expand Down
8 changes: 7 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ function run() {
// Install PocketIC.
const pocketicVersion = core.getInput('pocketic-version');
if (pocketicVersion) {
child_process_1.default.execSync(`wget -O ${bin}/pocket-ic.gz https://github.com/dfinity/pocketic/releases/download/${pocketicVersion}/pocket-ic-x86_64-${pocketicBuild}.gz`);
try {
child_process_1.default.execSync(`wget -O ${bin}/pocket-ic.gz https://github.com/dfinity/pocketic/releases/download/${pocketicVersion}/pocket-ic-x86_64-${pocketicBuild}.gz`);
}
catch (error) {
core.debug(`Failed to download pocket-ic, trying to download from the main ic repo...`);
child_process_1.default.execSync(`wget -O ${bin}/pocket-ic.gz https://github.com/dfinity/ic/releases/download/${pocketicVersion}/pocket-ic-x86_64-${pocketicBuild}.gz`);
}
child_process_1.default.execSync(`gunzip ${bin}/pocket-ic.gz`);
child_process_1.default.execSync(`chmod +x ${bin}/pocket-ic`);
const pocketicPath = yield io.which('pocket-ic');
Expand Down
13 changes: 10 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,16 @@ export async function run() {
// Install PocketIC.
const pocketicVersion = core.getInput('pocketic-version');
if (pocketicVersion) {
cp.execSync(
`wget -O ${bin}/pocket-ic.gz https://github.com/dfinity/pocketic/releases/download/${pocketicVersion}/pocket-ic-x86_64-${pocketicBuild}.gz`
);
try {
cp.execSync(
`wget -O ${bin}/pocket-ic.gz https://github.com/dfinity/pocketic/releases/download/${pocketicVersion}/pocket-ic-x86_64-${pocketicBuild}.gz`
);
} catch (error) {
core.debug(`Failed to download pocket-ic, trying to download from the main ic repo...`);
cp.execSync(
`wget -O ${bin}/pocket-ic.gz https://github.com/dfinity/ic/releases/download/${pocketicVersion}/pocket-ic-x86_64-${pocketicBuild}.gz`
);
}
cp.execSync(`gunzip ${bin}/pocket-ic.gz`);
cp.execSync(`chmod +x ${bin}/pocket-ic`);

Expand Down

0 comments on commit 8499faa

Please sign in to comment.