This repository was archived by the owner on Dec 5, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (120 loc) · 3.51 KB
/
rust.yml
File metadata and controls
124 lines (120 loc) · 3.51 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
name: rust
concurrency:
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
on:
pull_request:
branches: [ main, master ]
types: [ opened, synchronize, reopened ]
paths:
- "**/rust.yml"
- "**/*.rs"
- "**/Cargo.*"
push:
branches: [ main, master ]
tags: [ latest, v*, "*-nightly" ]
repository_dispatch:
types: [ rust ]
workflow_dispatch:
inputs:
benchmark:
default: false
description: 'Run benchmarks'
required: true
type: boolean
no_std:
default: false
description: 'Run tests with no_std feature'
required: true
type: boolean
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [ x86_64-unknown-linux-gnu ]
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
target: ${{ matrix.target }}
-
name: Build the workspace
run: cargo build --release --locked --workspace --all-features --target ${{ matrix.target }}
benchmark:
if: github.event_name == 'repository_dispatch' || github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') || github.event.inputs.benchmark == 'true'
needs: build
runs-on: ubuntu-latest
outputs:
results: ${{ steps.artifacts.outputs.artifact-id }}
permissions:
contents: write
checks: write
strategy:
fail-fast: false
matrix:
target: [ x86_64-unknown-linux-gnu ]
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache-key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
-
name: Benchmark (${{ matrix.target }})
run: cargo bench --locked --workspace --all-features --workspace --verbose --
-
name: Upload the benchmarks
id: artifacts
uses: actions/upload-artifact@v4
with:
name: benchmarks@${{ github.sha }}
if-no-files-found: error
overwrite: true
retention-days: 7
path: target/criterion/
test:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features: [ full, all, default ]
target: [ x86_64-unknown-linux-gnu ]
toolchain: [ stable ]
steps:
-
name: Checkout
uses: actions/checkout@v5
-
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
-
if: matrix.features != 'default' && matrix.features != 'all'
name: Test (${{ matrix.features }})
run: cargo test -r --locked --workspace --target ${{ matrix.target }} --features ${{ matrix.features }}
-
if: matrix.features == 'default'
name: Test (default)
run: cargo test -r --locked --workspace --target ${{ matrix.target }}
-
if: matrix.features == 'all'
name: Test (all-features)
run: cargo test -r --locked --workspace --target ${{ matrix.target }} --all-features