-
Notifications
You must be signed in to change notification settings - Fork 316
111 lines (92 loc) · 3.31 KB
/
rust.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
name: rust
on:
pull_request:
# Don't run Rust tests if only docs changed.
paths-ignore:
- 'docs/**'
# Also support ad-hoc calls for workflow.
workflow_call:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: buildjet-16vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: install nix
uses: nixbuild/nix-quick-install-action@v28
- name: setup nix cache
uses: nix-community/cache-nix-action@v5
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
backend: buildjet
- name: Load rust cache
uses: astriaorg/[email protected]
# The `rust-toolchain.toml` file dictates which version of rust to setup.
- name: check rust version
run: nix develop --command rustc --version
# Run `cargo check`, with a custom target dir for caching.
- name: run cargo check
run: nix develop --command just check
# If a dependency was modified, Cargo.lock may flap if not committed.
- name: Check for diffs
shell: bash
run: |
s="$(git status --porcelain)"
if [[ -n "$s" ]]; then
echo "ERROR: found modified files that should be committed:"
echo "$s"
git diff | head -n 128
exit 1
else
echo "OK: no uncommitted changes detected"
fi
# As of 2025Q1, the "features" job is the slowest in the CI suite.
# Consider moving to a scheduled job on main, rather than running on PRs.
features:
runs-on: buildjet-16vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: install nix
uses: nixbuild/nix-quick-install-action@v28
- name: setup nix cache
uses: nix-community/cache-nix-action@v5
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
backend: buildjet
- name: Load rust cache
uses: astriaorg/[email protected]
# Build each crate separately, to validate that the feature-gating is working.
# This is a lighter-weight version of `cargo check-all-features --workspace --release`.
- name: check crate features
run: nix develop --command ./deployments/scripts/check-crate-feature-sets
- name: check wasm compatibility
run: nix develop --command ./deployments/scripts/check-wasm-compat.sh
test:
runs-on: buildjet-16vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: install nix
uses: nixbuild/nix-quick-install-action@v28
- name: setup nix cache
uses: nix-community/cache-nix-action@v5
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
backend: buildjet
- name: Load rust cache
uses: astriaorg/[email protected]
- name: Run tests with nextest
run: nix develop --command just test
env:
CARGO_TERM_COLOR: always