diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cecd98f..7c37357 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/README.md b/README.md index fab7282..c3e37f9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Setup The Internet Computer SDK -This action sets up a `dfx` environment, also includes `moc` and `vessel`. +This action sets up a `dfx` environment, also includes `moc`, `vessel` and `pocket-ic`. -**!** Only supports Ubuntu/MacOS virtual environments. +**!** Only supports Ubuntu/macOS virtual environments. ## Usage @@ -10,7 +10,7 @@ This action sets up a `dfx` environment, also includes `moc` and `vessel`. runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 -- uses: aviate-labs/setup-dfx@v0.3.0 +- uses: aviate-labs/setup-dfx@v0.3.2 with: vessel-version: 0.7.0 - run: for i in src/*.mo ; do $(vessel bin)/moc $(vessel sources) --check $i ; done @@ -22,7 +22,7 @@ steps: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 -- uses: aviate-labs/setup-dfx@v0.3.0 +- uses: aviate-labs/setup-dfx@v0.3.2 with: dfx-version: 0.18.0 env: diff --git a/action.yml b/action.yml index 6789135..bd19819 100644 --- a/action.yml +++ b/action.yml @@ -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.' diff --git a/dist/index.js b/dist/index.js index 37cd272..90872df 100644 --- a/dist/index.js +++ b/dist/index.js @@ -56,7 +56,7 @@ function run() { let pocketicBuild = 'linux'; // Alter params if running on macOS. if (os_1.default.platform() === 'darwin') { - bin = '/usr/local/share'; + bin = '/Users/runner/bin'; vesselBuild = 'macos'; pocketicBuild = 'darwin'; } @@ -128,9 +128,15 @@ function run() { infoExec(`${vesselPath} --version`); } // Install PocketIC. - const pocketicVersion = core.getInput('pocketic-version'); + const pocketicVersion = core.getInput('pocket-ic-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'); diff --git a/src/main.ts b/src/main.ts index 7580845..d2823ae 100644 --- a/src/main.ts +++ b/src/main.ts @@ -12,7 +12,7 @@ export async function run() { // Alter params if running on macOS. if (os.platform() === 'darwin') { - bin = '/usr/local/share'; + bin = '/Users/runner/bin'; vesselBuild = 'macos'; pocketicBuild = 'darwin'; } @@ -100,11 +100,18 @@ export async function run() { } // Install PocketIC. - const pocketicVersion = core.getInput('pocketic-version'); + const pocketicVersion = core.getInput('pocket-ic-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`);