Skip to content

chore: release 0.49.2 — retry SERVICE_UNAVAILABLE (bounded) #2902

chore: release 0.49.2 — retry SERVICE_UNAVAILABLE (bounded)

chore: release 0.49.2 — retry SERVICE_UNAVAILABLE (bounded) #2902

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1
- name: Install wasm-pack and chromedriver for WASM tests
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
sudo apt-get install -y chromium-chromedriver
- name: Install node for SoftHSM tests
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
- name: Install and Configure SoftHSM
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
set -ex
sudo apt-get install -f libsofthsm2 opensc-pkcs11 opensc
sudo usermod -a -G softhsm $USER
echo "SOFTHSM2_CONF=$HOME/softhsm.conf" >>$GITHUB_ENV
echo "directories.tokendir = $HOME/softhsm/tokens/" >$HOME/softhsm.conf
mkdir -p $HOME/softhsm/tokens
- name: Download test assets
if: ${{ !contains(matrix.os, 'windows') }}
run: |
./scripts/download_reftest_assets.sh
- name: Run Tests (ref-tests)
# ref-tests are skipped on macOS CI: the GitHub Actions macOS runner has
# a low per-process thread limit (kern.maxthreadsperproc) that cannot be
# raised without root. pocket-ic spawns many OS threads per subnet, and
# tokio's blocking thread pool accumulates idle threads across sequential
# tests, exhausting the limit before all tests finish. This is a CI
# resource constraint — ref-tests work fine on a local macOS machine.
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
run: |
cd ref-tests
cargo test --no-fail-fast -- --test-threads=1
env:
RUST_BACKTRACE: 1
- name: Run Tests
shell: bash
run: |
# Test all features and no features for each package.
# ref-tests is excluded here and run separately with --test-threads=1
# to avoid exhausting OS thread limits when pocket-ic spawns many threads.
for p in $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name != "ref-tests") | .manifest_path'); do
pushd $(dirname $p)
cargo test --all-features --no-fail-fast
cargo test --no-default-features --no-fail-fast
popd
done
env:
RUST_BACKTRACE: 1
- name: Run Tests (WASM)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
CARGO_TARGET_DIR=target/wasm wasm-pack test --chrome --headless ic-agent --features wasm-bindgen
- name: Run Tests (SoftHSM)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
set -ex
softhsm2-util --init-token --slot $HSM_SLOT_INDEX --label "agent-rs-token" --so-pin $HSM_SO_PIN --pin $HSM_PIN
# create key:
pkcs11-tool -k --module $HSM_PKCS11_LIBRARY_PATH --login --slot-index $HSM_SLOT_INDEX -d $HSM_KEY_ID --key-type EC:prime256v1 --pin $HSM_PIN
cd ref-tests
cargo test --all-features --no-fail-fast -- --nocapture --test-threads=1
env:
RUST_BACKTRACE: 1
HSM_PKCS11_LIBRARY_PATH: /usr/lib/softhsm/libsofthsm2.so
HSM_SO_PIN: 123456
HSM_PIN: 1234
HSM_SLOT_INDEX: 0
HSM_KEY_ID: abcdef
aggregate:
name: test:required
runs-on: ubuntu-latest
if: ${{ always() }}
needs: test
steps:
- name: Check test result
if: ${{ needs.test.result != 'success' }}
run: exit 1