2021-07-29 20:22:25 +00:00
|
|
|
on:
|
|
|
|
push:
|
2021-10-30 13:52:38 +00:00
|
|
|
branches:
|
2021-07-29 20:22:25 +00:00
|
|
|
- master
|
|
|
|
pull_request:
|
2020-06-16 11:36:45 +00:00
|
|
|
|
|
|
|
name: Tests
|
|
|
|
|
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
|
2021-12-26 21:18:58 +00:00
|
|
|
RINKEBY_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"
|
2020-06-16 11:36:45 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
2021-07-29 20:22:25 +00:00
|
|
|
name: ethereum tests
|
2020-06-16 11:36:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
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
|
2020-06-16 11:36:45 +00:00
|
|
|
- name: Install Solc
|
|
|
|
run: |
|
|
|
|
mkdir -p "$HOME/bin"
|
2021-12-10 17:21:07 +00:00
|
|
|
wget -q https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux -O $HOME/bin/solc
|
2020-06-16 11:36:45 +00:00
|
|
|
chmod u+x "$HOME/bin/solc"
|
|
|
|
export PATH=$HOME/bin:$PATH
|
|
|
|
solc --version
|
|
|
|
|
2020-10-24 08:13:13 +00:00
|
|
|
- name: Install geth
|
|
|
|
run: |
|
|
|
|
mkdir -p "$HOME/bin"
|
|
|
|
wget -q https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
|
|
tar -xvf geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
|
|
mv geth-linux-amd64-1.9.23-8c2f2715/geth $HOME/bin/geth
|
|
|
|
chmod u+x "$HOME/bin/geth"
|
|
|
|
export PATH=$HOME/bin:$PATH
|
|
|
|
geth version
|
2020-06-16 11:36:45 +00:00
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
2021-09-13 20:48:03 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
2020-06-16 11:36:45 +00:00
|
|
|
- name: cargo test
|
|
|
|
run: |
|
|
|
|
export PATH=$HOME/bin:$PATH
|
2021-11-27 07:54:20 +00:00
|
|
|
export ETHERSCAN_API_KEY=$ETHERSCAN_API_KEY_ETHEREUM
|
2020-06-16 11:36:45 +00:00
|
|
|
cargo test
|
|
|
|
|
2020-12-31 17:19:14 +00:00
|
|
|
feature-tests:
|
2021-07-29 20:22:25 +00:00
|
|
|
name: celo tests
|
2020-12-31 17:19:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
# TODO: can we combine these shared steps in github actions?
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
|
|
with:
|
|
|
|
version: nightly
|
2020-12-31 17:19:14 +00:00
|
|
|
- name: Install Solc
|
|
|
|
run: |
|
|
|
|
mkdir -p "$HOME/bin"
|
2021-12-10 18:30:19 +00:00
|
|
|
wget -q https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux -O $HOME/bin/solc
|
2020-12-31 17:19:14 +00:00
|
|
|
chmod u+x "$HOME/bin/solc"
|
|
|
|
export PATH=$HOME/bin:$PATH
|
|
|
|
solc --version
|
|
|
|
- name: Install geth
|
|
|
|
run: |
|
|
|
|
mkdir -p "$HOME/bin"
|
|
|
|
wget -q https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
|
|
tar -xvf geth-linux-amd64-1.9.23-8c2f2715.tar.gz
|
|
|
|
mv geth-linux-amd64-1.9.23-8c2f2715/geth $HOME/bin/geth
|
|
|
|
chmod u+x "$HOME/bin/geth"
|
|
|
|
export PATH=$HOME/bin:$PATH
|
|
|
|
geth version
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
2021-09-13 20:48:03 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
2020-06-17 09:22:01 +00:00
|
|
|
- name: cargo test (Celo)
|
|
|
|
run: |
|
|
|
|
export PATH=$HOME/bin:$PATH
|
2021-11-27 07:54:20 +00:00
|
|
|
export ETHERSCAN_API_KEY=$ETHERSCAN_API_KEY_CELO
|
2020-09-24 21:33:09 +00:00
|
|
|
cargo test --all-features
|
2020-06-17 09:22:01 +00:00
|
|
|
|
2020-12-31 17:19:14 +00:00
|
|
|
lint:
|
2021-07-29 20:22:25 +00:00
|
|
|
name: lints
|
2020-12-31 17:19:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
2021-10-29 12:29:35 +00:00
|
|
|
- name: Install toolchain
|
2020-12-31 17:19:14 +00:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2022-03-27 18:27:01 +00:00
|
|
|
# nightly regression https://github.com/rust-lang/rust/issues/95267
|
|
|
|
toolchain: nightly-2022-03-20
|
2020-12-31 17:19:14 +00:00
|
|
|
profile: minimal
|
|
|
|
components: rustfmt, clippy
|
2021-10-29 12:29:35 +00:00
|
|
|
override: true
|
2021-09-13 20:48:03 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
2020-06-16 11:36:45 +00:00
|
|
|
- name: cargo fmt
|
2022-03-27 18:27:01 +00:00
|
|
|
run: cargo +nightly-2022-03-20 fmt --all -- --check
|
2020-06-16 11:36:45 +00:00
|
|
|
- name: cargo clippy
|
2022-03-28 16:42:48 +00:00
|
|
|
run: cargo +nightly-2022-03-20 clippy --all-features -- -D warnings
|
2021-08-23 09:56:44 +00:00
|
|
|
|
|
|
|
wasm:
|
|
|
|
name: WASM
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
2021-08-23 09:56:44 +00:00
|
|
|
- name: Install rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
target: wasm32-unknown-unknown
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
|
|
with:
|
|
|
|
version: nightly
|
|
|
|
|
2021-09-13 20:48:03 +00:00
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
|
|
|
|
2021-08-23 09:56:44 +00:00
|
|
|
- name: Check
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: check
|
|
|
|
args: --target wasm32-unknown-unknown
|
|
|
|
|
2022-06-01 15:22:39 +00:00
|
|
|
- name: Launch Anvil
|
|
|
|
run: anvil --block-time 2 -m "stuff inherit faith park genre spread huge knee ecology private marble supreme" &
|
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
|
|
|
|
|
|
|
|
- name: Wasm-pack test firefox
|
|
|
|
run: |
|
|
|
|
cd examples/ethers-wasm
|
|
|
|
wasm-pack test --headless --firefox
|
|
|
|
|
|
|
|
- name: Wasm-pack test chrome
|
|
|
|
run: |
|
|
|
|
cd examples/ethers-wasm
|
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
|
|
|
|
steps:
|
|
|
|
- name: Checkout sources
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install Anvil
|
|
|
|
uses: foundry-rs/foundry-toolchain@v1
|
|
|
|
with:
|
|
|
|
version: nightly
|
|
|
|
|
|
|
|
- name: Install Solc
|
|
|
|
run: |
|
|
|
|
mkdir -p "$HOME/bin"
|
|
|
|
wget -q https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux -O $HOME/bin/solc
|
|
|
|
chmod u+x "$HOME/bin/solc"
|
|
|
|
export PATH=$HOME/bin:$PATH
|
|
|
|
solc --version
|
|
|
|
|
|
|
|
- name: Install stable toolchain
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
|
|
|
- uses: Swatinem/rust-cache@v1
|
|
|
|
with:
|
|
|
|
cache-on-failure: true
|
|
|
|
- name: Build all examples
|
|
|
|
run: |
|
|
|
|
export PATH=$HOME/bin:$PATH
|
|
|
|
examples=$(cargo metadata --format-version 1 | \
|
|
|
|
jq -c '.packages[]
|
|
|
|
| select(.name == "ethers")
|
|
|
|
| .targets[]
|
|
|
|
| select(.kind[] | contains("example"))
|
|
|
|
| with_entries(select([.key]
|
|
|
|
| inside(["name", "required-features"])))'
|
|
|
|
)
|
|
|
|
for example in $examples; do
|
|
|
|
name="$(echo "$example" | jq -r '.name')"
|
|
|
|
args=(
|
|
|
|
-p ethers
|
|
|
|
--example "$name"
|
|
|
|
)
|
|
|
|
features="$(echo "$example" | jq -r 'try(."required-features" | join(","))')"
|
|
|
|
if [[ ! -z "$features" ]]; then
|
|
|
|
args+=(--features "$features")
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "building $name"
|
|
|
|
cargo build "${args[@]}"
|
|
|
|
done
|
|
|
|
- name: Run all examples
|
|
|
|
run: |
|
|
|
|
export PATH=$HOME/bin:$PATH
|
|
|
|
chmod +x ./scripts/examples.sh
|
|
|
|
./scripts/examples.sh
|
2021-12-13 21:25:10 +00:00
|
|
|
|
|
|
|
windows-build:
|
|
|
|
runs-on: windows-latest
|
|
|
|
name: (${{ matrix.target }}, ${{ matrix.cfg_release_channel }})
|
|
|
|
env:
|
|
|
|
CFG_RELEASE_CHANNEL: ${{ matrix.cfg_release_channel }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
target: [
|
|
|
|
i686-pc-windows-gnu,
|
|
|
|
i686-pc-windows-msvc,
|
|
|
|
x86_64-pc-windows-gnu,
|
|
|
|
x86_64-pc-windows-msvc,
|
|
|
|
]
|
|
|
|
cfg_release_channel: [nightly]
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# Run build
|
|
|
|
- name: Install Rustup using win.rustup.rs
|
|
|
|
run: |
|
|
|
|
# disable download progress bar
|
|
|
|
$ProgressPreference = "SilentlyContinue"
|
|
|
|
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
|
|
|
|
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none
|
|
|
|
del rustup-init.exe
|
|
|
|
rustup target add ${{ matrix.target }}
|
|
|
|
shell: powershell
|
|
|
|
|
|
|
|
- name: Add mingw32 to path for i686-gnu
|
|
|
|
run: |
|
|
|
|
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH
|
|
|
|
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly'
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Add mingw64 to path for x86_64-gnu
|
|
|
|
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH
|
|
|
|
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly'
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: build
|
|
|
|
run: |
|
|
|
|
rustc -Vv
|
|
|
|
cargo -V
|
2021-12-19 14:56:54 +00:00
|
|
|
# we test without --all-features on Windows so that sha2-asm is not activated.
|
|
|
|
cargo check
|
|
|
|
shell: cmd
|