-
Notifications
You must be signed in to change notification settings - Fork 79
194 lines (157 loc) · 5.8 KB
/
ci.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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
name: CI
on:
pull_request:
push:
branches:
- main
schedule:
# Force a run every day at 0005 UTC
- cron: '00 05 * * *'
env:
CI: '1'
CARGO_TERM_COLOR: 'always'
# Emit backtraces on panics (though these may be worthless without debug info).
RUST_BACKTRACE: '1'
# Disable incremental builds; see https://matklad.github.io/2021/09/04/fast-rust-builds.html:
#
# CI builds often are closer to from-scratch builds, as changes are typically much bigger than from a local edit-compile cycle.
# For from-scratch builds, incremental adds an extra dependency-tracking overhead.
# It also significantly increases the amount of IO and the size of ./target, which make caching less effective.
CARGO_INCREMENTAL: '0'
# Explicitly disable LTO in release builds here, even though Nosey Parker
# explicitly sets it. For actual release builds that get distributed we want
# it, but for builds used only for testing, it adds significant time to the
# build.
#
# https://doc.rust-lang.org/cargo/reference/profiles.html#lto
CARGO_PROFILE_RELEASE_LTO: 'false'
# Disable debug info in CI; speeds up builds and shrinks Actions caches a bit
CARGO_PROFILE_RELEASE_DEBUG: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
CARGO_PROFILE_TEST_DEBUG: '0'
# Enable Cargo output explaining why things are being rebuilt.
# This can be useful to investigate why caching is not working as expected.
#
# https://stackoverflow.com/a/70174212
# https://doc.crates.io/contrib/implementation/debugging.html#logging
# CARGO_LOG: 'cargo::core::compiler::fingerprint=info'
jobs:
tests:
name: CI (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: ubuntu-20.04.x86_64.stable.release
os: ubuntu-20.04
rust: stable
profile: release
features: -F release
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
cpu_info_cmd: 'cat /proc/cpuinfo'
check_docs: false
run_tests: true
- name: ubuntu-22.04.x86_64.stable.test
os: ubuntu-22.04
rust: stable
profile: test
features:
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
cpu_info_cmd: 'cat /proc/cpuinfo'
check_docs: true
run_tests: true
- name: ubuntu-24.04.x86_64.stable.nodefaultfeatures
os: ubuntu-24.04
rust: stable
profile: test
features: --no-default-features
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
cpu_info_cmd: 'cat /proc/cpuinfo'
check_docs: true
run_tests: true
- name: ubuntu-22.04.arm64.stable.release
os: ubuntu-22.04-arm64-8-core
rust: stable
profile: release
features: -F release
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
cpu_info_cmd: 'cat /proc/cpuinfo'
check_docs: false
run_tests: true
- name: ubuntu-24.04.arm64.stable.test
os: ubuntu-24.04-arm64-8-core
rust: stable
profile: test
features:
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
cpu_info_cmd: 'cat /proc/cpuinfo'
check_docs: true
run_tests: true
- name: macos-13.x86_64.stable.test
os: macos-13
rust: stable
profile: test
features:
install_dependencies: |
brew install coreutils boost
cpu_info_cmd: 'sysctl -a | grep machdep.cpu'
check_docs: false
run_tests: true
- name: macos-14.arm64.stable.test
os: macos-14 # m1-based macos
rust: stable
profile: test
features:
install_dependencies: |
brew install coreutils boost
cpu_info_cmd: 'sysctl -a | grep machdep.cpu'
check_docs: false
run_tests: true
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies
run: ${{ matrix.install_dependencies }}
- name: Install Rust toolchain
id: install-rust-toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Print CPU info
run: ${{ matrix.cpu_info_cmd }}
- name: Cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: 'ci-tests'
key: ${{ matrix.name }}
- name: Build tests
if: ${{ matrix.run_tests }}
run: cargo test --no-run --locked --verbose --profile=${{ matrix.profile }} ${{ matrix.features }} --timings
- name: Nosey Parker version
run: cargo run --locked --verbose --profile=${{ matrix.profile }} ${{ matrix.features }} -- --version
- name: Run tests
if: ${{ matrix.run_tests }}
env:
# We use the GitHub Actions automatic token when running tests, to avoid
# spurious failures from rate limiting when testing Nosey Parker's github
# enumeration capabilities.
NP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cargo test --locked --verbose --profile=${{ matrix.profile }} ${{ matrix.features }} --timings
- name: Check documentation
if: ${{ matrix.check_docs }}
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --locked --verbose --profile=${{ matrix.profile }} ${{ matrix.features }} --timings --no-deps --document-private-items
# See https://doc.rust-lang.org/nightly/cargo/reference/timings.html for details
- name: Upload build timings
uses: actions/upload-artifact@v4
with:
name: build-timings.${{ matrix.name }}
path: target/cargo-timings
if-no-files-found: error