Repository navigation
181 lines (173 loc) · 7.09 KB
/
Copy pathrust.yml
File metadata and controls
181 lines (173 loc) · 7.09 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Continuous integration
on: [push, pull_request]
permissions:
contents: read
jobs:
Test:
runs-on: ubuntu-26.04
strategy:
fail-fast: false
matrix:
rust:
- 1.85.0 # MSRV
- stable
- nightly-2026-11-09 # pinned nightly, bumped weekly by contrib/bump-nightly.sh
env:
# Override the value from the rust-toolchain file
# This is necessary because even though the correct toolchain
# is explicitly specified for the rust-toolchain action,
# rustup honors the rust-toolchain file over the default
RUSTUP_TOOLCHAIN: ${{ matrix.rust }}
steps:
- name: "Checkout repo"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Install ${{ matrix.rust }} toolchain"
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
# The toolchain must be specified manually, as this action ignores the rust-toolchain override
# https://github.com/dtolnay/rust-toolchain?tab=readme-ov-file#inputs
toolchain: ${{ matrix.rust }}
- name: Set up nix
uses: $/.github/actions/setup-nix
- name: "Add nginxWithStream to PATH"
run: |
# This is necessary for payjoin-mailroom integration tests
echo "$(nix build .#nginx-with-stream --print-out-paths --no-link)/bin" >> $GITHUB_PATH
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
shared-key: ${{ matrix.rust == 'stable' && 'stable-workspace' || matrix.rust == '1.85.0' && 'msrv-workspace' || '' }}
- name: Run tests
run: RUST_LOG=debug bash contrib/test.sh
Lint:
runs-on: ubuntu-26.04
steps:
- name: "Checkout repo"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Set up nix
uses: $/.github/actions/setup-nix
- name: "Run code linting"
run: nix develop -c ./contrib/lint.sh
- name: "Run documentation linting"
run: nix develop -c -- bash -c 'RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --document-private-items'
Coverage:
name: Code coverage
runs-on: ubuntu-26.04
strategy:
fail-fast: false
env:
# Override the value from the rust-toolchain file
# This is necessary because even though the correct toolchain
# is explicitly specified for the rust-toolchain action,
# rustup honors the rust-toolchain file over the default
RUSTUP_TOOLCHAIN: stable
steps:
- name: "Checkout repo"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Install toolchain"
# rust-cache usage with stable Rust is most effective, as a cache is tied to the Rust version
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: stable
- name: Set up nix
uses: $/.github/actions/setup-nix
- name: "Add nginxWithStream to PATH"
run: |
# This is necessary for payjoin-mailroom integration tests
echo "$(nix build .#nginx-with-stream --print-out-paths --no-link)/bin" >> $GITHUB_PATH
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@c509219cf42fba86913069efd0ade2458c59337b # v2.90.1
with:
tool: cargo-llvm-cov
- name: "Generate code coverage for tests"
run: bash contrib/coverage.sh
- name: "Upload report to coveralls"
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
with:
fail-on-error: false
CodeSpell:
name: Code spell check
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- uses: codespell-project/actions-codespell@8f01853be192eb0f849a5c7d721450e7a467c579 # v2.2
DiffMutants:
name: Diff cargo-mutants
runs-on: ubuntu-26.04
env:
RUSTUP_TOOLCHAIN: stable
steps:
- name: "Checkout repo"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
fetch-depth: 0 # required for full diff context
- name: Fetch base branch for diff
env:
BASE_REF: ${{ github.base_ref }}
run: git fetch origin "$BASE_REF"
- name: Relative diff
env:
BASE_REF: ${{ github.base_ref }}
run: |
git branch -av
git diff origin/${BASE_REF}.. -- '*.rs' | tee git.diff
- uses: taiki-e/install-action@c509219cf42fba86913069efd0ade2458c59337b # v2.90.1
with:
tool: cargo-mutants@27.1.0
- name: "Install toolchain"
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
toolchain: stable
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: Run cargo-mutants on diff
run: >
cargo mutants --no-shuffle --in-diff git.diff
--test-tool=cargo --timeout=500 --build-timeout=500
- name: Upload mutants.out
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always()
with:
name: mutants-incremental-cargo.out
path: mutants.out
Fuzz:
name: Fuzz build
runs-on: ubuntu-26.04
steps:
- name: "Checkout repo"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false # unneeded: no git auth beyond checkout
- name: "Install nightly toolchain"
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
with:
# pinned nightly, bumped weekly by contrib/bump-nightly.sh
toolchain: nightly-2026-11-09
- name: "Use cache"
uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
lookup-only: ${{ startsWith(github.ref, 'refs/tags/') }}
- name: "Prepare lockfile"
run: cp Cargo-recent.lock Cargo.lock
- name: "Build fuzz targets"
run: cd fuzz && cargo build --locked