Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Commit 6147354

Browse files
authored
Clean up github workflows (#1537)
### Description - Remove bitrot task which was building the benchmarks and examples but we don't have any - Merge cargo fmt, clippy and doc links into a single job to reduce noise - Split heavy tests and light tests into two jobs to parallelize the work - Merge all feature tests into a single job to reduce noise. - Disable integration tests on pull requests because they are taking a long time currently. Enable them only when the trigger-integration-test label is set, when they are scheduled via cron, or when pushing to main. --- - Times before: 57 minutes - Longest: Integration tests: 57 min - Second longest: Tests: 28 min - Times now: 19 minutes - Longest: Light unit tests: 19 min - Second longest: Heavy unit tests: 16 min
1 parent 350a7a2 commit 6147354

File tree

5 files changed

+70
-159
lines changed

5 files changed

+70
-159
lines changed

.github/workflows/integration.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ concurrency:
2828

2929
jobs:
3030
set-outputs:
31-
if: github.event.pull_request.draft == false
31+
if: github.event_name == 'schedule' ||
32+
github.event_name == 'push' ||
33+
github.event_name == 'workflow_dispatch' ||
34+
contains(github.event.pull_request.labels.*.name, 'trigger-integration-tests')
3235

3336
runs-on: ubuntu-latest
3437
outputs:

.github/workflows/labeler.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: "Pull Request Labeler"
1+
name: Pull Request Labeler
22
on:
33
- pull_request_target
44

55
jobs:
66
triage:
7+
name: Triage
78
runs-on: ubuntu-latest
89
steps:
9-
- uses: actions/labeler@v3
10+
- uses: actions/checkout@v2
11+
- name: Labeler
12+
uses: actions/labeler@v4
1013
with:
1114
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/lints.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ jobs:
2222
concurrent_skipping: 'same_content_newer'
2323
paths_ignore: '["**/README.md"]'
2424

25-
clippy:
25+
lints:
2626
needs: [skip_check]
2727
if: |
2828
github.event.pull_request.draft == false &&
2929
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
3030
31-
name: Clippy
31+
name: Various lints
3232
timeout-minutes: 30
3333
runs-on: ubuntu-latest
3434

3535
steps:
3636
- uses: actions/checkout@v2
3737
- uses: actions-rs/toolchain@v1
3838
with:
39-
components: clippy
39+
components: rustfmt, clippy
4040
override: false
4141
# Go cache for building geth-utils
4242
- name: Go cache
@@ -45,7 +45,7 @@ jobs:
4545
path: |
4646
~/.cache/go-build
4747
~/go/pkg/mod
48-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
48+
key: lint-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
4949
restore-keys: |
5050
${{ runner.os }}-go-
5151
- name: Cargo cache
@@ -57,10 +57,24 @@ jobs:
5757
~/.cargo/registry/cache/
5858
~/.cargo/git/db/
5959
target/
60-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
60+
key: lint-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
61+
62+
- name: Check code format
63+
uses: actions-rs/cargo@v1
64+
with:
65+
command: fmt
66+
args: --all -- --check
67+
6168
- name: Run clippy
62-
uses: actions-rs/clippy-check@v1
69+
uses: actions-rs/cargo@v1
6370
with:
64-
name: Clippy
65-
token: ${{ secrets.GITHUB_TOKEN }}
71+
command: clippy
6672
args: --all-features --all-targets -- -D warnings
73+
74+
# Ensure intra-documentation links all resolve correctly
75+
# Requires #![deny(intra_doc_link_resolution_failure)] in crates.
76+
- name: Check intra-doc links
77+
uses: actions-rs/cargo@v1
78+
with:
79+
command: doc
80+
args: --no-deps --all --document-private-items
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI checks
1+
name: Main tests
22

33
on:
44
merge_group:
@@ -28,13 +28,13 @@ jobs:
2828
concurrent_skipping: 'same_content_newer'
2929
paths_ignore: '["**/README.md"]'
3030

31-
test:
31+
lighttest:
3232
needs: [skip_check]
3333
if: |
3434
github.event.pull_request.draft == false &&
3535
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
3636
37-
name: Test
37+
name: Light unit tests
3838
runs-on: ["${{github.run_id}}", self-hosted, c5.9xlarge]
3939

4040
steps:
@@ -71,124 +71,30 @@ jobs:
7171
with:
7272
command: test
7373
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks
74-
- name: Run heavy tests # heavy tests are run serially to avoid OOM
75-
uses: actions-rs/cargo@v1
76-
with:
77-
command: test
78-
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks serial_ -- --ignored --test-threads 1
7974
- name: Run testool internal tests
8075
uses: actions-rs/cargo@v1
8176
with:
8277
command: test
8378
args: --release --manifest-path testool/Cargo.toml
84-
build:
85-
needs: [skip_check]
86-
if: |
87-
github.event.pull_request.draft == false &&
88-
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
89-
90-
name: Build target ${{ matrix.target }}
91-
runs-on: ubuntu-latest
92-
strategy:
93-
matrix:
94-
target:
95-
- wasm32-unknown-unknown
96-
- wasm32-wasi
97-
98-
steps:
99-
- uses: actions/checkout@v2
100-
- uses: actions-rs/toolchain@v1
101-
with:
102-
override: false
103-
- name: Add target
104-
run: rustup target add ${{ matrix.target }}
105-
# Go cache for building geth-utils
106-
- name: Go cache
107-
uses: actions/cache@v3
108-
with:
109-
path: |
110-
~/.cache/go-build
111-
~/go/pkg/mod
112-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
113-
restore-keys: |
114-
${{ runner.os }}-go-
115-
- name: Cargo cache
116-
uses: actions/cache@v3
117-
with:
118-
path: |
119-
~/.cargo/bin/
120-
~/.cargo/registry/index/
121-
~/.cargo/registry/cache/
122-
~/.cargo/git/db/
123-
target/
124-
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
125-
- name: cargo build
126-
uses: actions-rs/cargo@v1
127-
with:
128-
command: build
129-
args: --all-features
130-
# Make sure benchmarks compile.
131-
- name: cargo build benchmarks no-run
132-
uses: actions-rs/cargo@v1
133-
with:
134-
command: test
135-
args: --verbose --release --all-features -p circuit-benchmarks --no-run
13679

137-
bitrot:
80+
heavytests:
13881
needs: [skip_check]
13982
if: |
14083
github.event.pull_request.draft == false &&
14184
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
14285
143-
name: Bitrot check
144-
runs-on: ubuntu-latest
86+
name: Heavy unit tests
87+
runs-on: ["${{github.run_id}}", self-hosted, c5.9xlarge]
14588

14689
steps:
14790
- uses: actions/checkout@v2
14891
- uses: actions-rs/toolchain@v1
14992
with:
15093
override: false
151-
# Go cache for building geth-utils
152-
- name: Go cache
153-
uses: actions/cache@v3
154-
with:
155-
path: |
156-
~/.cache/go-build
157-
~/go/pkg/mod
158-
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
159-
restore-keys: |
160-
${{ runner.os }}-go-
161-
- name: Cargo cache
162-
uses: actions/cache@v3
163-
with:
164-
path: |
165-
~/.cargo/bin/
166-
~/.cargo/registry/index/
167-
~/.cargo/registry/cache/
168-
~/.cargo/git/db/
169-
target/
170-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
171-
# Build benchmarks to prevent bitrot
172-
- name: Build benchmarks
173-
uses: actions-rs/cargo@v1
174-
with:
175-
command: build
176-
args: --benches --examples --all-features
177-
178-
doc-links:
179-
needs: [skip_check]
180-
if: |
181-
github.event.pull_request.draft == false &&
182-
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
183-
184-
name: Intra-doc links
185-
runs-on: ubuntu-latest
186-
187-
steps:
188-
- uses: actions/checkout@v2
189-
- uses: actions-rs/toolchain@v1
94+
- name: Setup golang
95+
uses: actions/setup-go@v3
19096
with:
191-
override: false
97+
go-version: ~1.19
19298
# Go cache for building geth-utils
19399
- name: Go cache
194100
uses: actions/cache@v3
@@ -209,33 +115,32 @@ jobs:
209115
~/.cargo/git/db/
210116
target/
211117
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
212-
- name: cargo fetch
213-
uses: actions-rs/cargo@v1
214-
with:
215-
command: fetch
216-
217-
# Ensure intra-documentation links all resolve correctly
218-
# Requires #![deny(intra_doc_link_resolution_failure)] in crates.
219-
- name: Check intra-doc links
118+
- name: Run heavy tests # heavy tests are run serially to avoid OOM
220119
uses: actions-rs/cargo@v1
221120
with:
222-
command: doc
223-
args: --no-deps --all --document-private-items
121+
command: test
122+
args: --verbose --release --all --all-features --exclude integration-tests --exclude circuit-benchmarks serial_ -- --ignored --test-threads 1
224123

225-
fmt:
124+
build:
226125
needs: [skip_check]
227126
if: |
228127
github.event.pull_request.draft == false &&
229128
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
230129
231-
name: Rustfmt
232-
timeout-minutes: 30
130+
name: Build target ${{ matrix.target }}
233131
runs-on: ubuntu-latest
132+
strategy:
133+
matrix:
134+
target:
135+
- x86_64-unknown-linux-gnu
136+
234137
steps:
235138
- uses: actions/checkout@v2
236139
- uses: actions-rs/toolchain@v1
237140
with:
238141
override: false
142+
- name: Add target
143+
run: rustup target add ${{ matrix.target }}
239144
# Go cache for building geth-utils
240145
- name: Go cache
241146
uses: actions/cache@v3
@@ -255,14 +160,9 @@ jobs:
255160
~/.cargo/registry/cache/
256161
~/.cargo/git/db/
257162
target/
258-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
259-
- name: cargo check
163+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
164+
- name: cargo build
260165
uses: actions-rs/cargo@v1
261166
with:
262-
command: check
167+
command: build
263168
args: --all-features
264-
- run: rustup component add rustfmt
265-
- uses: actions-rs/cargo@v1
266-
with:
267-
command: fmt
268-
args: --all -- --check

.github/workflows/test-features.yml

+15-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test feature flags
1+
name: Feature flags
22

33
on:
44
merge_group:
@@ -26,18 +26,11 @@ jobs:
2626
if: |
2727
github.event.pull_request.draft == false &&
2828
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
29+
name: Validate features exist
2930
timeout-minutes: 30
3031
runs-on: ubuntu-latest
3132
strategy:
3233
fail-fast: false
33-
matrix:
34-
crate:
35-
- zkevm-circuits
36-
feature:
37-
- default
38-
- test-circuits
39-
- test-util
40-
- warn-unimplemented
4134
steps:
4235
- uses: actions/checkout@v2
4336
- uses: actions-rs/toolchain@v1
@@ -51,7 +44,7 @@ jobs:
5144
path: |
5245
~/.cache/go-build
5346
~/go/pkg/mod
54-
key: ${{ github.workflow }}-${{ matrix.crate }}-${{ matrix.feature }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
47+
key: ${{ github.workflow }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
5548

5649
- name: Cargo cache
5750
uses: actions/cache@v3
@@ -62,21 +55,19 @@ jobs:
6255
~/.cargo/registry/cache/
6356
~/.cargo/git/db/
6457
target/
65-
key: ${{ github.workflow }}-${{ matrix.crate }}-${{ matrix.feature }}-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
58+
key: ${{ github.workflow }}-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
6659

67-
- name: '${{ matrix.crate }}: ${{ matrix.feature }}'
60+
- name: Import with features
6861
run: |
6962
GIT_ROOT=$(pwd)
7063
cd /tmp
71-
cargo new foobar
72-
cd foobar
73-
cp "${GIT_ROOT}/rust-toolchain" . || true
74-
cargo add --path "${GIT_ROOT}/${{ matrix.crate }}" --features '${{ matrix.feature }}'
75-
cd ../
76-
rm -rf foobar
77-
78-
test_features_complete:
79-
needs: [test_features]
80-
runs-on: ubuntu-latest
81-
steps:
82-
- run: echo dummy
64+
for crate in zkevm-circuits; do
65+
for feature in default test-circuits test-util warn-unimplemented; do
66+
cargo new foobar
67+
cd foobar
68+
cp "${GIT_ROOT}/rust-toolchain" . || true
69+
cargo add --path "${GIT_ROOT}/${crate}" --features "${feature}"
70+
cd ../
71+
rm -rf foobar
72+
done
73+
done

0 commit comments

Comments
 (0)