2023-03-01 00:26:27 +00:00
|
|
|
name: CI
|
|
|
|
|
2021-07-29 20:22:25 +00:00
|
|
|
on:
|
|
|
|
push:
|
2023-03-01 00:26:27 +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:
|
2023-03-01 00:26:27 +00:00
|
|
|
ETHERSCAN_API_KEY: "I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB"
|
2022-10-07 15:58:32 +00:00
|
|
|
GOERLI_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"
|
2023-03-01 00:26:27 +00:00
|
|
|
GETH_BUILD: "1.11.2-73b01f40"
|
|
|
|
SOLC_VERSION: "0.8.19"
|
|
|
|
CARGO_TERM_COLOR: always
|
2020-06-16 11:36:45 +00:00
|
|
|
|
|
|
|
jobs:
|
2023-03-01 00:26:27 +00:00
|
|
|
test:
|
2023-03-16 19:28:35 +00:00
|
|
|
name: test ${{ matrix.os }} (${{ matrix.flags.name }})
|
2023-03-01 00:26:27 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-03-16 19:28:35 +00:00
|
|
|
os: ["ubuntu-latest", "macos-latest"]
|
|
|
|
flags:
|
|
|
|
- name: no default features
|
|
|
|
flags: --workspace --no-default-features
|
|
|
|
- name: default features
|
|
|
|
flags: --workspace
|
|
|
|
- name: all features
|
2023-03-01 00:26:27 +00:00
|
|
|
flags: --workspace --all-features
|
2023-03-16 19:28:35 +00:00
|
|
|
include:
|
|
|
|
# not workspace because compiling examples fails for no reason in CI,
|
|
|
|
- os: windows-latest
|
|
|
|
flags:
|
|
|
|
name: no default features
|
|
|
|
flags: -p ethers --no-default-features
|
|
|
|
- os: windows-latest
|
|
|
|
flags:
|
|
|
|
name: default features
|
|
|
|
flags: -p ethers
|
|
|
|
- os: windows-latest
|
|
|
|
flags:
|
|
|
|
name: all features
|
|
|
|
flags: -p ethers --all-features
|
2020-06-16 11:36:45 +00:00
|
|
|
steps:
|
2023-03-01 00:26:27 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2023-03-05 20:15:59 +00:00
|
|
|
with:
|
2023-03-16 19:28:35 +00:00
|
|
|
toolchain:
|
|
|
|
${{ matrix.os == 'windows-latest' && 'stable-x86_64-pc-windows-gnu' ||
|
|
|
|
'stable' }}
|
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-03-01 00:26:27 +00:00
|
|
|
- name: Install test binaries
|
|
|
|
shell: bash
|
|
|
|
run: ./.github/scripts/install_test_binaries.sh
|
|
|
|
- name: Install nextest
|
|
|
|
uses: taiki-e/install-action@nextest
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2023-03-16 19:28:35 +00:00
|
|
|
- name: test ${{ matrix.flags.flags }}
|
2023-03-01 00:26:27 +00:00
|
|
|
shell: bash
|
|
|
|
# skip `ethers_etherscan::it` and `ethers::live`
|
2020-06-16 11:36:45 +00:00
|
|
|
run: |
|
2023-03-01 00:26:27 +00:00
|
|
|
cargo nextest run \
|
2023-03-16 19:28:35 +00:00
|
|
|
${{ matrix.flags.flags }} \
|
2023-03-01 00:26:27 +00:00
|
|
|
-E "!binary(~live) & !(deps(ethers-etherscan) & kind(test))"
|
2020-06-16 11:36:45 +00:00
|
|
|
|
2023-03-01 00:26:27 +00:00
|
|
|
etherscan-tests:
|
|
|
|
name: etherscan tests
|
2020-12-31 17:19:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-03-01 00:26:27 +00:00
|
|
|
concurrency: etherscan-tests-${{ github.head_ref || github.run_id }}
|
|
|
|
# Run after main tests are done to avoid rate limiting,
|
|
|
|
# regardless of whether they were successful
|
|
|
|
if: ${{ always() }}
|
|
|
|
needs: test
|
2020-12-31 17:19:14 +00:00
|
|
|
steps:
|
2023-03-01 00:26:27 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
# Don't use cargo-nextest since all the tests have to be ran sequentially
|
|
|
|
- name: live tests
|
|
|
|
run: cargo test -p ethers-etherscan --test it
|
|
|
|
|
|
|
|
live-tests:
|
|
|
|
name: live tests
|
2020-12-31 17:19:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-03-01 00:26:27 +00:00
|
|
|
concurrency: live-tests-${{ github.head_ref || github.run_id }}
|
2020-12-31 17:19:14 +00:00
|
|
|
steps:
|
2023-03-01 00:26:27 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: live tests
|
|
|
|
run: cargo test -p ethers --test live --all-features
|
|
|
|
|
|
|
|
# TODO: [#2191](https://github.com/gakonst/ethers-rs/issues/2191)
|
|
|
|
# feature-checks:
|
|
|
|
# name: feature checks
|
|
|
|
# runs-on: ubuntu-latest
|
|
|
|
# steps:
|
|
|
|
# - uses: actions/checkout@v3
|
|
|
|
# - uses: dtolnay/rust-toolchain@nightly
|
|
|
|
# - uses: taiki-e/install-action@cargo-hack
|
|
|
|
# - uses: Swatinem/rust-cache@v2
|
|
|
|
# - 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-03-01 00:26:27 +00:00
|
|
|
components: clippy
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: clippy
|
|
|
|
run: cargo clippy --workspace --tests --all-features
|
|
|
|
env:
|
|
|
|
RUSTFLAGS: "-D warnings"
|
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-03-01 00:26:27 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
2022-11-07 23:44:06 +00:00
|
|
|
with:
|
2023-03-01 00:26:27 +00:00
|
|
|
components: rust-docs
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: doc
|
|
|
|
run: cargo doc --workspace --all-features --no-deps --document-private-items
|
2022-11-07 23:44:06 +00:00
|
|
|
env:
|
2023-03-01 00:26:27 +00:00
|
|
|
RUSTFLAGS: "--cfg docsrs"
|
|
|
|
RUSTDOCFLAGS: "--cfg docsrs -D warnings"
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
name: fmt
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
|
|
with:
|
|
|
|
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-03-01 00:26:27 +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-03-01 00:26:27 +00:00
|
|
|
- uses: Swatinem/rust-cache@v2
|
2021-08-23 09:56:44 +00:00
|
|
|
- name: Check
|
2023-03-01 00:26:27 +00:00
|
|
|
run: cargo check --workspace --target wasm32-unknown-unknown
|
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-03-01 00:26:27 +00:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
- name: Run wasm example
|
|
|
|
working-directory: examples/ethers-wasm
|
2021-08-23 09:56:44 +00:00
|
|
|
run: |
|
2023-03-01 00:26:27 +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
|
|
|
|
|
2022-06-01 15:22:39 +00:00
|
|
|
examples:
|
|
|
|
name: Examples
|
|
|
|
runs-on: ubuntu-latest
|
2023-03-01 00:26:27 +00:00
|
|
|
concurrency: examples-${{ github.head_ref || github.run_id }}
|
2022-06-01 15:22:39 +00:00
|
|
|
steps:
|
2023-03-01 00:26:27 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
|
|
with:
|
|
|
|
version: nightly
|
2023-03-01 00:26:27 +00:00
|
|
|
- name: Install test binaries
|
|
|
|
run: ./.github/scripts/install_test_binaries.sh
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
2022-12-29 12:53:11 +00:00
|
|
|
- name: Build and run all examples
|
2023-03-01 00:26:27 +00:00
|
|
|
run: ./scripts/examples.sh
|