Skip to content

Commit e8af5cb

Browse files
committed
ci: Split out worflows
This change splits out our GitHub workflows to run conditionally, depending on which files change in a pull request. * `build`: builds the proxy in release mode wh * `check-each`: checks that each Cargo.toml checks cleanly on its own. This used to be a serial task, but has been converted to a matrix job. * `deps`: Only runs on dependency changes to check cargo-deny * `integration`: Runs integration tests on code & dependency changes. * `lint`: Runs clippy, fmt, and doc on all source changes. Not run on dependency changes. * `test`: Runs unit tests on code and dependency changes This prevents doing needless work on dependency changes (as these are extremely common) and makes it easier to rerun narrower workflows, if necessary. The best part of this, though, is that we've made `check-each` a matrix job so that its tests can be parallelized. We'll update the github settings to make none of these checks strictly required. Signed-off-by: Oliver Gould <[email protected]>
1 parent d410b44 commit e8af5cb

File tree

8 files changed

+222
-116
lines changed

8 files changed

+222
-116
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Builds the proxy as if it were a release.
2+
name: build
3+
4+
permissions:
5+
contents: read
6+
7+
on:
8+
pull_request:
9+
paths:
10+
# We don't run this workflow on dependency changes. It's mainly intended to determine how long
11+
# a release build takes given Linkerd changes. We don't really need to run this on every
12+
# dependabot change, though.
13+
- linkerd/**
14+
- linkerd2-proxy/**
15+
- .github/workflows/build.yml
16+
17+
env:
18+
CARGO_INCREMENTAL: 0
19+
CARGO_NET_RETRY: 10
20+
RUST_BACKTRACE: short
21+
RUSTUP_MAX_RETRIES: 10
22+
23+
jobs:
24+
release:
25+
timeout-minutes: 20
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
29+
- env:
30+
CARGO_RELEASE: "1"
31+
run: make build

.github/workflows/check-each.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Check each crate independently. Helps to catch dependency issues.
2+
name: check-each
3+
4+
permissions:
5+
contents: read
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- Cargo.lock
11+
- linkerd/**
12+
- linkerd2-proxy/**
13+
- .github/workflows/check-each.yml
14+
15+
env:
16+
CARGO_INCREMENTAL: 0
17+
CARGO_NET_RETRY: 10
18+
RUST_BACKTRACE: short
19+
RUSTUP_MAX_RETRIES: 10
20+
21+
jobs:
22+
enumerate:
23+
timeout-minutes: 1
24+
runs-on: ubuntu-latest
25+
env:
26+
DEBIAN_FRONTEND: noninteractive
27+
steps:
28+
- run: apt update && apt install -y jo
29+
- id: enumerate
30+
run: |
31+
dirs() {
32+
for toml in $(find . -mindepth 2 \
33+
-not -path '*/fuzz/*' \
34+
-not -path './linkerd/meshtls/boring/*' \
35+
-name Cargo.toml \
36+
| sort -r)
37+
do
38+
echo "${toml%/*}"
39+
done
40+
}
41+
echo "::set-output name=dirs::$(dirs | jo -a)"
42+
outputs:
43+
dirs: ${{ steps.enumerate.outputs.dirs }}`
44+
45+
check:
46+
needs: enumerate
47+
timeout-minutes: 20
48+
runs-on: ubuntu-latest
49+
strategy:
50+
matrix:
51+
dir: ${{ fromJson(needs.enumerate.outputs.dirs) }}
52+
container:
53+
image: docker://rust:1.56.1-buster
54+
steps:
55+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
56+
- name: check ${{ matrix.dir }}
57+
run: cd ${{ matrix.dir }} && cargo check --all-targets
58+

.github/workflows/coverage.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
name: Coverage
22

3-
# Run daily at 11AM UTC (3AM PST).
3+
permissions:
4+
contents: read
5+
46
on:
7+
pull_request:
8+
paths:
9+
- .github/workflows/coverage.yml
510
schedule:
6-
# cron: minute hour day month day-of-week
11+
# Run daily at 11AM UTC (3AM PST).
712
- cron: '0 11 * * *'
813

914
env:
1015
CARGO_INCREMENTAL: 0
1116
CARGO_NET_RETRY: 10
1217
CARGO_TARPAULIN_VERSION: 0.18.5
18+
DEBIAN_FRONTEND: noninteractive
1319
RUST_BACKTRACE: short
1420
RUSTUP_MAX_RETRIES: 10
1521

16-
permissions:
17-
contents: read
18-
1922
jobs:
2023
test:
2124
name: codecov

.github/workflows/deps.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Each job should typically run in under 5 minutes.
2+
name: deps
3+
4+
permissions:
5+
contents: read
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- Cargo.lock
11+
- .github/workflows/deps.yml
12+
13+
env:
14+
CARGO_INCREMENTAL: 0
15+
CARGO_NET_RETRY: 10
16+
RUST_BACKTRACE: short
17+
RUSTUP_MAX_RETRIES: 10
18+
19+
jobs:
20+
# Check for security advisories.
21+
#
22+
# Failures are not fatal, since issues are opened in the linkerd2 repo, via rustsecbot.
23+
advisories:
24+
timeout-minutes: 10
25+
runs-on: ubuntu-latest
26+
continue-on-error: true
27+
steps:
28+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
29+
- uses: EmbarkStudios/cargo-deny-action@4340bbf5bc9e7034fae7c4857e9ab87cab35c905
30+
with:
31+
command: check advisories
32+
33+
# Audit licenses, unreleased crates, and unexpected duplicate versions.
34+
bans:
35+
timeout-minutes: 10
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
39+
- uses: EmbarkStudios/cargo-deny-action@4340bbf5bc9e7034fae7c4857e9ab87cab35c905
40+
with:
41+
command: check bans licenses sources

.github/workflows/slow.yml renamed to .github/workflows/integration.yml

Lines changed: 15 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,28 @@
1-
# Each job typically runs for more than 5 minutes.
2-
name: slow
1+
# Run integration tests
2+
name: integration
3+
4+
permissions:
5+
contents: read
36

47
on:
5-
pull_request: {}
8+
pull_request:
9+
paths:
10+
- Cargo.lock
11+
- linkerd/**
12+
- linkerd2-proxy/**
13+
- .github/workflows/integration.yml
614

715
env:
816
CARGO_INCREMENTAL: 0
917
CARGO_NET_RETRY: 10
1018
RUST_BACKTRACE: short
1119
RUSTUP_MAX_RETRIES: 10
1220

13-
permissions:
14-
contents: read
15-
21+
# Run only the app-level tests. These may take longer to compile (usually due to very large stack
22+
# types) and have the potential to be flakey as they depend on opening sockets and may have timing
23+
# sensitivity.
1624
jobs:
17-
18-
# Iterate through all (non-fuzzer) sub-crates to ensure each compiles independently.
19-
check-each-crate:
20-
timeout-minutes: 20
21-
runs-on: ubuntu-latest
22-
container:
23-
image: docker://rust:1.56.1-buster
24-
steps:
25-
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
26-
- run: |
27-
for toml in $(find . -mindepth 2 \
28-
-not -path '*/fuzz/*' \
29-
-not -path './linkerd/meshtls/boring/*' \
30-
-name Cargo.toml \
31-
| sort -r)
32-
do
33-
d="${toml%/*}"
34-
echo "# $d"
35-
(cd $d ; cargo check --all-targets)
36-
done
37-
38-
check-release:
39-
timeout-minutes: 20
40-
runs-on: ubuntu-latest
41-
steps:
42-
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
43-
- env:
44-
CARGO_RELEASE: "1"
45-
run: make build
46-
47-
# Run only the app-level tests. These may take longer to compile (usually due to very large stack
48-
# types) and have the potential to be flakey as they depend on opening sockets and may have timing
49-
# sensitivity.
50-
test-integration:
25+
test:
5126
timeout-minutes: 20
5227
runs-on: ubuntu-latest
5328
container:

.github/workflows/lint.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Each job should typically run in under 5 minutes.
2+
name: fast
3+
4+
permissions:
5+
contents: read
6+
7+
on:
8+
pull_request:
9+
paths:
10+
- linkerd/**/*.rs
11+
- linkerd2-proxy/**/*.rs
12+
- .github/workflows/lint.yml
13+
14+
env:
15+
CARGO_INCREMENTAL: 0
16+
CARGO_NET_RETRY: 10
17+
RUST_BACKTRACE: short
18+
RUSTUP_MAX_RETRIES: 10
19+
20+
jobs:
21+
clippy:
22+
timeout-minutes: 10
23+
runs-on: ubuntu-latest
24+
container:
25+
image: docker://rust:1.56.1-buster
26+
steps:
27+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
28+
- run: rustup component add clippy
29+
- run: cargo clippy --all --exclude=linkerd-meshtls-boring
30+
31+
fmt:
32+
timeout-minutes: 10
33+
runs-on: ubuntu-latest
34+
container:
35+
image: docker://rust:1.56.1-buster
36+
steps:
37+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
38+
- run: rustup component add rustfmt
39+
- run: make check-fmt
40+
41+
docs:
42+
timeout-minutes: 10
43+
runs-on: ubuntu-latest
44+
container:
45+
image: docker://rust:1.56.1-buster
46+
steps:
47+
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
48+
- run: |
49+
cargo doc --all --no-deps \
50+
--exclude=linkerd-meshtls \
51+
--exclude=linkerd-meshtls-boring \
52+
--exclude=linkerd-meshtls-rustls
53+

.github/workflows/nightly.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# stable.
33
name: nightly
44

5+
permissions:
6+
contents: read
7+
58
on:
69
pull_request:
710
paths:
@@ -16,9 +19,6 @@ env:
1619
RUST_BACKTRACE: short
1720
RUSTUP_MAX_RETRIES: 10
1821

19-
permissions:
20-
contents: read
21-
2222
jobs:
2323
build:
2424
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)