feat: client-side ratelimiting and auto-retrying 429s (#549) #2159
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1 | |
- name: Install wasm-pack and chromedriver | |
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: Run Tests | |
shell: bash | |
run: | | |
# Test all features and no features for each package. | |
for p in $(cargo metadata --no-deps --format-version 1 | jq -r .packages[].manifest_path); do | |
pushd $(dirname $p) | |
cargo test --all-targets --all-features | |
cargo test --all-targets --no-default-features | |
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: Purge for OSX | |
if: matrix.os == 'macos-latest' | |
run: | | |
# There is a bug with BSD tar on macOS where the first 8MB of the file are | |
# sometimes all NUL bytes. See https://github.com/actions/cache/issues/403 | |
# and https://github.com/rust-lang/cargo/issues/8603 for some more | |
# information. An alternative solution here is to install GNU tar, but | |
# flushing the disk cache seems to work, too. | |
sudo /usr/sbin/purge | |
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 |