-
Notifications
You must be signed in to change notification settings - Fork 10
151 lines (137 loc) · 4.15 KB
/
ci.yml
File metadata and controls
151 lines (137 loc) · 4.15 KB
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
name: CI
on:
push:
branches:
- master
- main
- dev
pull_request:
branches:
- master
- main
- dev
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main' }}
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
check-workspace:
name: Check workspace conventions
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: true
- uses: ./.github/actions/install-base
- uses: ./.github/actions/setup-rust
- name: cargo xtask check-workspace
run: |
cargo xtask check-workspace
format:
name: Format
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: true
- uses: ./.github/actions/install-base
- uses: ./.github/actions/setup-rust
- name: Check formatting
run: |
cargo fmt --all -- --check
lint:
name: Lint (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15]
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: true
- uses: ./.github/actions/install-base
- uses: ./.github/actions/setup-rust
- name: Run clippy
run: |
cargo run -p cargo-matrix -- --command clippy
check:
name: Check (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15]
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: write
packages: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: true
- uses: ./.github/actions/install-base
- uses: ./.github/actions/setup-rust
- name: Check
run: |
cargo run -p cargo-matrix -- --command check
build:
name: Build (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15]
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: write
packages: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: true
- uses: ./.github/actions/install-base
- uses: ./.github/actions/setup-rust
- name: Build Release
run: |
cargo run -p cargo-matrix -- --command build
basics-checks:
name: Basic checks
needs: [check-workspace, format, lint, check]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
all-checks:
needs: [basics-checks, build]
# Override the default execution condition to prevent this job from being skipped
# if its dependencies fail. In GitHub Actions, a skipped job is considered successful,
# which is not the desired behavior here. Also, ensure the job does not run when
# the workflow is manually canceled.
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
# Manually check the status of all dependencies. `if: failure()` does not work.
- name: Conclusion
run: |
# Print the dependent jobs to see them in the CI log
jq -C <<< '${{ toJson(needs) }}'
# Check if all jobs that we depend on (in the needs array) were successful.
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'