2023-02-24 19:45:48 +00:00
|
|
|
name: CI
|
|
|
|
|
2021-07-29 20:22:25 +00:00
|
|
|
on:
|
|
|
|
push:
|
2023-02-24 19:45:48 +00:00
|
|
|
branches: [master]
|
2021-07-29 20:22:25 +00:00
|
|
|
pull_request:
|
2020-06-16 11:36:45 +00:00
|
|
|
|
2020-07-03 16:52:09 +00:00
|
|
|
# Yeah I know it's bad practice to have API keys, this is a read-only API key
|
|
|
|
# so that we do not get rate limited by Etherscan (and it's free to generate as
|
|
|
|
# many as you want)
|
2020-06-16 11:36:45 +00:00
|
|
|
env:
|
2021-11-27 07:54:20 +00:00
|
|
|
ETHERSCAN_API_KEY_ETHEREUM: I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB
|
|
|
|
ETHERSCAN_API_KEY_CELO: B13XSMUT6Q3Q4WZ5DNQR8RXDBA2KNTMT4M
|
2022-10-07 15:58:32 +00:00
|
|
|
GOERLI_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"
|
2023-02-24 19:45:48 +00:00
|
|
|
GETH_BUILD: "1.11.2-73b01f40"
|
|
|
|
SOLC_VERSION: "0.8.19"
|
|
|
|
RUSTFLAGS: "-D warnings"
|
2020-06-16 11:36:45 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
2023-02-24 19:45:48 +00:00
|
|
|
name: tests ${{ matrix.toolchain }}-${{ matrix.job.target }}
|
|
|
|
runs-on: ${{ matrix.job.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
job:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
- os: macos-latest
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
- os: windows-latest
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
toolchain: ["stable", "nightly"]
|
2023-02-24 20:57:53 +00:00
|
|
|
exclude:
|
|
|
|
# ntapi crate does not compile on nightly due to E0793:
|
|
|
|
# https://github.com/gakonst/ethers-rs/actions/runs/4266119447/jobs/7426254381
|
2023-02-24 21:13:47 +00:00
|
|
|
- job:
|
|
|
|
os: windows-latest
|
2023-02-24 20:57:53 +00:00
|
|
|
toolchain: nightly
|
2020-06-16 11:36:45 +00:00
|
|
|
steps:
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
targets: ${{ matrix.job.target }}
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
2020-06-16 11:36:45 +00:00
|
|
|
with:
|
2022-06-01 15:22:39 +00:00
|
|
|
version: nightly
|
2023-02-24 19:45:48 +00:00
|
|
|
- name: Install test binaries
|
|
|
|
shell: bash
|
|
|
|
run: ./.github/scripts/install_test_binaries.sh
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-09-13 20:48:03 +00:00
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
2023-02-24 19:45:48 +00:00
|
|
|
- name: test
|
|
|
|
shell: bash
|
2020-06-16 11:36:45 +00:00
|
|
|
run: |
|
2023-02-24 19:45:48 +00:00
|
|
|
export ETHERSCAN_API_KEY="$ETHERSCAN_API_KEY_ETHEREUM"
|
2023-02-24 20:57:53 +00:00
|
|
|
cargo +${{ matrix.toolchain }} test --workspace --target ${{ matrix.job.target }}
|
2020-06-16 11:36:45 +00:00
|
|
|
|
2020-12-31 17:19:14 +00:00
|
|
|
feature-tests:
|
2023-02-24 19:45:48 +00:00
|
|
|
name: feature tests ${{ matrix.toolchain }}-${{ matrix.job.target }}
|
|
|
|
runs-on: ${{ matrix.job.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
job:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
target: x86_64-unknown-linux-gnu
|
|
|
|
- os: macos-latest
|
|
|
|
target: x86_64-apple-darwin
|
2023-02-24 22:44:45 +00:00
|
|
|
# Note: we cannot compile --all-features on windows due to sha2-asm
|
2023-02-24 19:45:48 +00:00
|
|
|
toolchain: ["stable", "nightly"]
|
2020-12-31 17:19:14 +00:00
|
|
|
steps:
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.toolchain }}
|
|
|
|
targets: ${{ matrix.job.target }}
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
|
|
with:
|
|
|
|
version: nightly
|
2023-02-24 19:45:48 +00:00
|
|
|
- name: Install test binaries
|
|
|
|
shell: bash
|
|
|
|
run: ./.github/scripts/install_test_binaries.sh
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-09-13 20:48:03 +00:00
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
2023-02-24 19:45:48 +00:00
|
|
|
- name: test
|
|
|
|
shell: bash
|
2020-06-17 09:22:01 +00:00
|
|
|
run: |
|
2023-02-24 19:45:48 +00:00
|
|
|
export ETHERSCAN_API_KEY="$ETHERSCAN_API_KEY_CELO"
|
2023-02-24 20:57:53 +00:00
|
|
|
cargo +${{ matrix.toolchain }} test --workspace --target ${{ matrix.job.target }} --all-features
|
2020-06-17 09:22:01 +00:00
|
|
|
|
2023-02-24 20:57:53 +00:00
|
|
|
feature-checks:
|
|
|
|
name: feature checks
|
2020-12-31 17:19:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
|
|
- uses: taiki-e/install-action@cargo-hack
|
2023-02-24 21:29:45 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2023-02-24 19:45:48 +00:00
|
|
|
- name: cargo hack
|
|
|
|
run:
|
|
|
|
cargo hack check --all --feature-powerset --depth 2 -Z avoid-dev-deps --keep-going
|
|
|
|
|
|
|
|
clippy:
|
|
|
|
name: clippy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
2021-09-13 20:48:03 +00:00
|
|
|
with:
|
2023-02-24 19:45:48 +00:00
|
|
|
components: clippy
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: clippy
|
|
|
|
run: cargo clippy --workspace --tests --all-features
|
2021-08-23 09:56:44 +00:00
|
|
|
|
2022-11-07 23:44:06 +00:00
|
|
|
docs:
|
|
|
|
name: docs
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
# TODO: Remove nightly override: rust-lang/rust#{108334,108378}
|
|
|
|
toolchain: nightly-2023-02-07
|
|
|
|
components: rust-docs
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: doc
|
|
|
|
run: cargo doc --lib --workspace --all-features
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
name: fmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
2022-11-07 23:44:06 +00:00
|
|
|
with:
|
2023-02-24 19:45:48 +00:00
|
|
|
components: rustfmt
|
|
|
|
- name: fmt --check
|
|
|
|
run: cargo fmt --all --check
|
2022-11-07 23:44:06 +00:00
|
|
|
|
2021-08-23 09:56:44 +00:00
|
|
|
wasm:
|
|
|
|
name: WASM
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2021-08-23 09:56:44 +00:00
|
|
|
with:
|
|
|
|
target: wasm32-unknown-unknown
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
|
|
with:
|
|
|
|
version: nightly
|
|
|
|
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-08-23 09:56:44 +00:00
|
|
|
- name: Check
|
2023-02-24 21:29:45 +00:00
|
|
|
run: cargo test --workspace --target wasm32-unknown-unknown
|
2023-02-24 19:45:48 +00:00
|
|
|
- name: Check all features
|
2023-02-24 21:29:45 +00:00
|
|
|
run: cargo test --workspace --target wasm32-unknown-unknown --all-features
|
2021-08-23 09:56:44 +00:00
|
|
|
|
|
|
|
- name: Install wasm-pack
|
|
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
cache: yarn
|
|
|
|
- name: Run wasm example
|
2021-08-23 09:56:44 +00:00
|
|
|
run: |
|
|
|
|
cd examples/ethers-wasm
|
2023-02-24 19:45:48 +00:00
|
|
|
yarn
|
|
|
|
yarn anvil &
|
2021-08-23 09:56:44 +00:00
|
|
|
wasm-pack test --headless --firefox
|
2021-08-30 11:00:30 +00:00
|
|
|
wasm-pack test --headless --chrome
|
2023-02-24 19:45:48 +00:00
|
|
|
kill %1
|
2021-08-30 11:00:30 +00:00
|
|
|
|
2022-06-01 15:22:39 +00:00
|
|
|
examples:
|
|
|
|
name: Examples
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
|
|
with:
|
|
|
|
version: nightly
|
2023-02-24 19:45:48 +00:00
|
|
|
- name: Install test binaries
|
|
|
|
run: ./.github/scripts/install_test_binaries.sh
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
2023-02-24 19:45:48 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-06-01 15:22:39 +00:00
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
2022-12-29 12:53:11 +00:00
|
|
|
- name: Build and run all examples
|
2023-02-24 19:45:48 +00:00
|
|
|
run: ./scripts/examples.sh
|