-
Notifications
You must be signed in to change notification settings - Fork 248
139 lines (127 loc) · 4.65 KB
/
Copy pathtests-unit.yml
File metadata and controls
139 lines (127 loc) · 4.65 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
name: Unit Tests
on:
pull_request:
branches: [main]
paths:
- "**/*.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
- .config/nextest.toml
- .github/workflows/tests-unit.yml
push:
branches: [main]
paths:
- "**/*.rs"
- "**/Cargo.toml"
- "**/Cargo.lock"
- .config/nextest.toml
- .github/workflows/tests-unit.yml
# Ensures that only one workflow task will run at a time. Previous builds, if
# already in process, will get cancelled. Only the latest commit will be allowed
# to run, cancelling any workflows in between
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUST_LIB_BACKTRACE: 1
RUST_LOG: info
COLORBT_SHOW_HIDDEN: 1
jobs:
unit-tests:
name: ${{ matrix.rust-version }} on ${{ matrix.os }}
permissions:
id-token: write
statuses: write
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust-version: [stable, beta]
features: [default-release-binaries]
exclude:
# Exclude macOS beta due to limited runner capacity and slower performance
# Exclude Windows beta to reduce the amount of minutes cost per workflow run
- os: macos-latest
rust-version: beta
- os: windows-latest
rust-version: beta
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@ab6845274e2ff01cd4462007e1a9d9df1ab49f42 #v1.14.0
with:
toolchain: ${{ matrix.rust-version }}
cache-key: unit-tests-${{ matrix.os }}-${{ matrix.rust-version }}-${{ matrix.features }}
cache-on-failure: true
- uses: taiki-e/install-action@3ee5d63d29478156148c0b53e9f3447829b47bc2 #v2.58.23
with:
tool: cargo-nextest
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b #v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Windows-specific setup
- name: Install LLVM on Windows
if: matrix.os == 'windows-latest'
run: |
choco install llvm -y
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Minimise proptest cases on macOS and Windows
# We set cases to 1, because some tests already run 1 case by default.
# We keep maximum shrink iterations at the default value, because it only happens on failure.
#
# Windows compilation and tests are slower than other platforms.
if: matrix.os == 'windows-latest'
run: |
echo "PROPTEST_CASES=1" >> $GITHUB_ENV
echo "PROPTEST_MAX_SHRINK_ITERS=1024" >> $GITHUB_ENV
- name: Run unit tests
run: cargo nextest run --profile all-tests --locked --release --features "${{ matrix.features }}" --run-ignored=all
env:
TEST_LARGE_CHECKPOINTS: 1
check-no-git-dependencies:
name: Check no git dependencies
permissions:
id-token: write
statuses: write
runs-on: ubuntu-latest
timeout-minutes: 30
if: contains(github.event.pull_request.labels.*.name, 'A-release')
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
persist-credentials: false
- uses: actions-rust-lang/setup-rust-toolchain@ab6845274e2ff01cd4462007e1a9d9df1ab49f42 #v1.14.0
with:
toolchain: stable
cache-on-failure: true
- uses: taiki-e/install-action@3ee5d63d29478156148c0b53e9f3447829b47bc2 #v2.58.23
with:
tool: cargo-nextest
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b #v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check no git dependencies
run: cargo nextest run --profile check-no-git-dependencies
test-success:
name: test success
runs-on: ubuntu-latest
if: always()
needs:
- unit-tests
- check-no-git-dependencies
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe #v1.2.2
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: check-no-git-dependencies