forked from payjoin/rust-payjoin
-
Notifications
You must be signed in to change notification settings - Fork 0
161 lines (153 loc) · 5.28 KB
/
rust.yml
File metadata and controls
161 lines (153 loc) · 5.28 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
name: Continuous integration
on: [push, pull_request]
jobs:
Test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
- 1.85.0 # MSRV
- stable
- nightly
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@v4
- name: "Install ${{ matrix.rust }} toolchain"
uses: dtolnay/rust-toolchain@master
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: "Install nix"
uses: DeterminateSystems/determinate-nix-action@main
- name: "Use nix cache"
uses: DeterminateSystems/magic-nix-cache-action@main
- name: "Add nginxWithStream to PATH"
run: |
# This is necessary for ohttp-relay integration tests
echo "$(nix build .#nginx-with-stream --print-out-paths --no-link)/bin" >> $GITHUB_PATH
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: Run tests
run: RUST_LOG=debug bash contrib/test.sh
Lint-FFI:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install nightly toolchain"
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Run linting check"
run: cd payjoin-ffi && bash contrib/lint.sh
Lint:
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install nightly toolchain"
uses: dtolnay/rust-toolchain@nightly
with:
components: clippy
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Run code linting"
run: bash contrib/lint.sh
- name: "Run documentation linting"
run: RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --document-private-items
Coverage:
name: Code coverage
runs-on: ubuntu-latest
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@v4
- 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@stable
- name: "Install nix"
uses: DeterminateSystems/determinate-nix-action@main
- name: "Use nix cache"
uses: DeterminateSystems/magic-nix-cache-action@main
- name: "Add nginxWithStream to PATH"
run: |
# This is necessary for ohttp-relay integration tests
echo "$(nix build .#nginx-with-stream --print-out-paths --no-link)/bin" >> $GITHUB_PATH
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Install cargo-llvm-cov"
uses: taiki-e/install-action@cargo-llvm-cov
- name: "Generate code coverage for tests"
run: bash contrib/coverage.sh
- name: "Upload report to coveralls"
uses: coverallsapp/github-action@v2
with:
fail-on-error: false
CodeSpell:
name: Code spell check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
DiffMutants:
name: Diff cargo-mutants
runs-on: ubuntu-latest
env:
RUSTUP_TOOLCHAIN: stable
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for full diff context
- name: Fetch base branch for diff
run: git fetch origin ${{ github.base_ref }}
- name: Relative diff
run: |
git branch -av
git diff origin/${{ github.base_ref }}.. -- '*.rs' | tee git.diff
- uses: taiki-e/install-action@v2
with:
tool: cargo-mutants@25.2.2
- name: "Install toolchain"
uses: dtolnay/rust-toolchain@stable
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- 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@v4
if: always()
with:
name: mutants-incremental-cargo.out
path: mutants.out
Fuzz:
name: Fuzz build
runs-on: ubuntu-latest
steps:
- name: "Checkout repo"
uses: actions/checkout@v4
- name: "Install nightly toolchain"
uses: dtolnay/rust-toolchain@nightly
- name: "Use cache"
uses: Swatinem/rust-cache@v2
- name: "Build fuzz targets"
run: cd fuzz && cargo build