-
-
Notifications
You must be signed in to change notification settings - Fork 25
151 lines (124 loc) · 3.9 KB
/
ci.yaml
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:
- main
pull_request:
workflow_dispatch:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
pre-job:
runs-on: ubuntu-24.04
permissions:
actions: write
contents: read
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: "never"
skip_after_successful_duplicate: "true"
paths_ignore: '["**/README.md", "**/docs/**"]'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
clippy:
name: Clippy
runs-on: ubuntu-24.04
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: clang curl pkg-config xz-utils libxv-dev ninja-build meson nasm protobuf-compiler
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
components: clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-${{ steps.setup-rust.outputs.cachekey }}"
key: clippy
- name: Make sure code is linted
run: cargo +nightly xtask powerset clippy
fmt:
name: Fmt
runs-on: ubuntu-24.04
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
components: rustfmt
- name: Make sure code is formatted
run: cargo +nightly fmt --check
hakari:
name: Hakari
runs-on: ubuntu-24.04
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
- uses: cargo-bins/cargo-binstall@main
- uses: taiki-e/install-action@v2
with:
tool: cargo-hakari
- name: Make sure Hakari is up-to-date
run: |
set -xeo pipefail
cargo hakari manage-deps --dry-run
cargo hakari generate --diff
cargo hakari verify
test:
name: Test
runs-on: ubuntu-24.04
needs: pre-job
if: ${{ needs.pre-job.outputs.should_skip != 'true' }}
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: clang curl pkg-config xz-utils libxv-dev ninja-build meson nasm protobuf-compiler
- uses: dtolnay/rust-toolchain@stable
id: setup-rust
with:
toolchain: nightly
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-${{ steps.setup-rust.outputs.cachekey }}"
key: test
- uses: cargo-bins/cargo-binstall@main
- uses: taiki-e/install-action@v2
with:
tool: cargo-nextest,cargo-llvm-cov
# Note; we don't run the powerset here because it's very slow on CI
# Perhaps we should consider it at some point.
- name: Run tests
run: cargo +nightly llvm-cov nextest --branch --no-fail-fast --all-features --lcov --output-path ./lcov.info --profile ci
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
files: ./lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
files: ./target/nextest/ci/junit.xml
token: ${{ secrets.CODECOV_TOKEN }}