-
-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (164 loc) · 5.46 KB
/
rust.yml
File metadata and controls
168 lines (164 loc) · 5.46 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
name: rust
concurrency:
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
on:
pull_request:
branches: [main, master]
# types: [auto_merge_enabled, opened, ready_for_review, reopened]
types: [synchronize]
paths:
- ".github/workflows/rust.yml"
- "Cargo.toml"
- "Cargo.lock"
- "**.rs"
push:
branches: [main, master]
tags: [latest, v*, "*-nightly"]
repository_dispatch:
types: [rust, rust-ci]
release:
types: [created]
workflow_dispatch:
inputs:
benchmark:
description: "Run benchmarks (requires cargo-criterion)"
required: false
type: boolean
toolchain:
default: stable
description: "Select a toolchain to test (stable, nightly)"
required: true
type: choice
options: [stable, nightly]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64-unknown-linux-gnu]
toolchain: [stable]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
override: true
- name: Build the workspace
run: cargo build -r --locked --workspace --features full --target ${{ matrix.target }}
benchmark:
if: github.event_name == 'workflow_dispatch' && github.event.inputs.benchmark || false
needs: build
runs-on: ubuntu-latest
outputs:
id: ${{ steps.artifacts.outputs.artifact-id }}
digest: ${{ steps.artifacts.outputs.artifact-digest }}
url: ${{ steps.artifacts.outputs.artifact-url }}
strategy:
fail-fast: false
matrix:
features: [full]
target: [x86_64-unknown-linux-gnu]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.client_payload.ref || github.ref }}
repository: ${{ github.repository }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install cargo-criterion
uses: taiki-e/install-action@v2
with:
tool: cargo-criterion
- name: Benchmark (${{ matrix.target }})
run: cargo criterion --benches --locked --verbose --workspace --features ${{ matrix.features }} --target ${{ matrix.target }}
- name: Upload the benchmarks
id: artifacts
uses: actions/upload-artifact@v7
with:
name: Benchmark Report (${{ github.run_id }})
if-no-files-found: error
overwrite: true
path: target/criterion/
test:
if: github.event_name != 'workflow_dispatch' || github.event.inputs.toolchain != 'nightly'
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features: [full, default]
target: [x86_64-unknown-linux-gnu]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
target: ${{ matrix.target }}
toolchain: stable
override: true
- name: Test (default)
if: matrix.features == 'default'
run: cargo test -r --locked --workspace --target ${{ matrix.target}}
- name: Test (${{ matrix.features }})
if: matrix.features != 'default'
run: cargo test -r --locked --workspace --target ${{ matrix.target}} --features ${{ matrix.features }}
test_nightly:
if: github.event_name == 'workflow_dispatch' && github.event.inputs.toolchain == 'nightly' || false
continue-on-error: true
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [x86_64-unknown-linux-gnu]
features:
- all
- no_std
- "alloc,nightly"
package:
- rstm-state
- rstm-traits
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
toolchain: nightly
override: true
- name: Test (all-features)
if: matrix.features == 'all'
run: cargo test -r --locked --all-features --target ${{ matrix.target }} -p ${{ matrix.package }}
- name: Test (no_std)
continue-on-error: true
if: matrix.features == 'no_std'
run: cargo test -r --locked --no-default-features --target ${{ matrix.target }} -p ${{ matrix.package }}
env:
RUSTFLAGS: "-C panic=abort -Z panic_abort_tests"
- name: Test (${{ matrix.features }})
continue-on-error: true
if: matrix.features != 'all' && matrix.features != 'no_std'
run: cargo test -r --locked --no-default-features --target ${{ matrix.target }} -p ${{ matrix.package }} -F ${{ matrix.features }}
env:
RUSTFLAGS: "-C panic=abort -Z panic_abort_tests"