-
Notifications
You must be signed in to change notification settings - Fork 764
182 lines (169 loc) · 6.39 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: CI
on:
push:
branches: [master]
pull_request:
# 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)
env:
ETHERSCAN_API_KEY: "I5BXNZYP5GEDWFINGVEZKYIVU2695NPQZB"
GOERLI_PRIVATE_KEY: "fa4a1a79e869a96fcb42727f75e3232d6865a82ea675bb95de967a7fe6a773b2"
GETH_BUILD: "1.11.2-73b01f40"
SOLC_VERSION: "0.8.19"
CARGO_TERM_COLOR: always
jobs:
test:
name: test ${{ matrix.os }} ${{ matrix.flags }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
flags: ["--workspace", "--workspace --all-features"]
exclude:
# sha2-asm
- os: windows-latest
flags: --workspace --all-features
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.os == 'windows-latest' && 'stable-x86_64-pc-windows-gnu' || 'stable' }}
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- 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
- name: test
shell: bash
# skip `ethers_etherscan::it` and `ethers::live`
run: |
cargo nextest run \
${{ matrix.flags }} \
-E "!binary(~live) & !(deps(ethers-etherscan) & kind(test))"
etherscan-tests:
name: etherscan tests
runs-on: ubuntu-latest
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
steps:
- 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
runs-on: ubuntu-latest
concurrency: live-tests-${{ github.head_ref || github.run_id }}
steps:
- 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
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: clippy
run: cargo clippy --workspace --tests --all-features
env:
RUSTFLAGS: "-D warnings"
docs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-docs
- uses: Swatinem/rust-cache@v2
- name: doc
run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
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
wasm:
name: WASM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- uses: Swatinem/rust-cache@v2
- name: Check
run: cargo check --workspace --target wasm32-unknown-unknown
# TODO: [#2191](https://github.com/gakonst/ethers-rs/issues/2191)
# - name: Check all features
# run: cargo check --workspace --target wasm32-unknown-unknown --all-features
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Run wasm example
working-directory: examples/ethers-wasm
run: |
yarn
yarn anvil &
wasm-pack test --headless --firefox
wasm-pack test --headless --chrome
examples:
name: Examples
runs-on: ubuntu-latest
concurrency: examples-${{ github.head_ref || github.run_id }}
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Install Anvil
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install test binaries
run: ./.github/scripts/install_test_binaries.sh
- uses: Swatinem/rust-cache@v2
- name: Build and run all examples
run: ./scripts/examples.sh