-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (111 loc) · 3.52 KB
/
rust.yml
File metadata and controls
115 lines (111 loc) · 3.52 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
name: rust
concurrency:
cancel-in-progress: false
group: ${{ github.workflow }}-${{ github.ref }}
on:
pull_request:
branches: [main, master]
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:
toolchain:
default: stable
description: "Choose which toolchain to test (stable, nightly, all)"
required: true
type: choice
options: [stable, nightly, all]
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
- 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 }}
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
- 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 != 'stable'
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- all
- no_std
- "alloc,nightly"
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 --workspace
- name: Test (no_std)
continue-on-error: true
if: matrix.features == 'no_std'
run: cargo test -r --locked --no-default-features --workspace
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 --features ${{ matrix.features }} --workspace
env:
RUSTFLAGS: "-C panic=abort -Z panic_abort_tests"