Skip to content

feat: add the ability to create an unrecorded canister on a network #2025

feat: add the ability to create an unrecorded canister on a network

feat: add the ability to create an unrecorded canister on a network #2025

Workflow file for this run

name: Test
on:
push:
branches:
- main
pull_request:
env:
# When getting Rust dependencies, retry on network error:
CARGO_NET_RETRY: 10
# Use the local .curlrc
CURL_HOME: .
# Disable incremental compilation
CARGO_INCREMENTAL: 0
# These variables should be shared with WSL
WSLENV: CARGO_INCREMENTAL:CURL_HOME/p:CARGO_NET_RETRY:GITHUB_ENV/p:GITHUB_OUTPUT/p
defaults:
run:
shell: bash
jobs:
discover:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- id: set-matrix
run: echo "matrix=$(python3 .github/scripts/test-matrix.py)" >> $GITHUB_OUTPUT
unit-tests:
name: Unit tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Make the os matrix match .github/scripts/test-matrix.py so that
# we optimize caching
os: [ubuntu-22.04, macos-15, windows-2025]
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.rustup/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup image (Linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: ./.github/scripts/provision-linux-build.sh
- uses: t1m0thyj/unlock-keyring@e481cdc8833d4417a58f40734e8f197183317047
if: ${{ contains(matrix.os, 'ubuntu') }}
- name: Run unit tests
run: cargo test --workspace --lib --bins
test:
name: ${{ matrix.test }} on ${{ matrix.os }}
# Wait until unit tests have run so we can reuse the cache
needs: [discover, unit-tests]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{fromJson(needs.discover.outputs.matrix)}}
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.rustup/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: Setup image (Linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: ./.github/scripts/provision-linux-build.sh && ./.github/scripts/provision-linux-test.sh
- name: Setup image (macOS)
if: ${{ contains(matrix.os, 'macos') }}
run: ./.github/scripts/provision-macos-test.sh
- name: Setup image (Windows)
if: ${{ contains(matrix.os, 'windows') }}
run: .github/scripts/provision-windows-test.ps1
shell: pwsh
- name: Setup WSL2 (Windows)
if: ${{ contains(matrix.os, 'windows') }}
uses: Vampire/setup-wsl@6a8db447be7ed35f2f499c02c6e60ff77ef11278 # v6.0.0
with:
distribution: Ubuntu-22.04
- name: Setup Docker in WSL2 (Windows)
if: ${{ contains(matrix.os, 'windows') }}
run: .github/scripts/init-docker.sh
shell: wsl-bash_Ubuntu-22.04 {0}
- uses: t1m0thyj/unlock-keyring@e481cdc8833d4417a58f40734e8f197183317047
if: ${{ contains(matrix.os, 'ubuntu') }}
- name: Install mops
uses: dfinity/setup-mops@v1
- name: Verify mops installation
run: |
which mops
mops --version
- name: Install ic-wasm
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/dfinity/ic-wasm/releases/download/0.9.10/ic-wasm-installer.sh | sh
- name: Verify ic-wasm installation
run: |
which ic-wasm
ic-wasm --version
- name: Install wasm-tools
uses: taiki-e/install-action@3ae7038495f79cd771208b38319ff728a8b24538 # v2.67.3
with:
tool: wasm-tools
- name: Verify wasm-tools installation
run: |
which wasm-tools
wasm-tools --version
- name: Run ${{ matrix.test }}
# the macos runners do not support Docker
run: cargo test --test ${{ matrix.test }} -- ${{ contains(matrix.os, 'macos') && '--skip :docker:' || '' }}
env:
ICP_CLI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
aggregate:
name: test:required
if: ${{ always() }}
runs-on: ubuntu-latest
needs: [unit-tests, test]
steps:
- name: check result
if: ${{ needs.unit-tests.result != 'success' || needs.test.result != 'success' }}
run: exit 1