-
Notifications
You must be signed in to change notification settings - Fork 9
131 lines (126 loc) · 3.92 KB
/
rust.yml
File metadata and controls
131 lines (126 loc) · 3.92 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
# SPDX-FileCopyrightText: Yalan Zhang <yalzhang@redhat.com>
# SPDX-FileCopyrightText: Timothée Ravier <tim@siosm.fr>
# SPDX-FileCopyrightText: Jakob Naucke <jnaucke@redhat.com>
#
# SPDX-License-Identifier: CC0-1.0
# Inspired by https://github.com/coreos/repo-templates
name: "Rust"
on:
pull_request:
branches:
- "main"
permissions:
contents: "read"
# Don't waste job slots on superseded code
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
tests-stable:
name: "Tests, stable toolchain"
runs-on: "ubuntu-24.04"
container: "ghcr.io/trusted-execution-clusters/buildroot:fedora"
steps:
- name: "Check out repository"
uses: actions/checkout@v6
- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: "Install Go toolchain"
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: "Cache build artifacts"
uses: Swatinem/rust-cache@v2
- name: "Build CRDs"
run: make crds-rs
- name: "cargo build"
run: cargo build --all-targets
- name: "cargo test"
run: cargo test --bins
tests-release-stable:
name: "Tests (release), stable toolchain"
runs-on: "ubuntu-24.04"
container: "ghcr.io/trusted-execution-clusters/buildroot:fedora"
steps:
- name: "Check out repository"
uses: actions/checkout@v6
- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
- name: "Install Go toolchain"
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: "Cache build artifacts"
uses: Swatinem/rust-cache@v2
- name: "Build CRDs"
run: make crds-rs
- name: "cargo build (release)"
run: cargo build --lib --release
- name: "cargo test (release)"
run: cargo test --bins --release
tests-release-msrv:
name: "Tests (release), minimum supported toolchain"
runs-on: "ubuntu-24.04"
container: "ghcr.io/trusted-execution-clusters/buildroot:fedora"
steps:
- name: "Check out repository"
uses: actions/checkout@v6
- name: "Detect crate MSRV"
run: |
msrv=$(cargo metadata --format-version 1 --no-deps | \
jq -r '.packages[0].rust_version')
echo "Crate MSRV: $msrv"
echo "MSRV=$msrv" >> $GITHUB_ENV
- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ env.MSRV }}
components: rustfmt
- name: "Install Go toolchain"
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: "Cache build artifacts"
uses: Swatinem/rust-cache@v2
- name: "Build CRDs"
run: make crds-rs
- name: "cargo build (release)"
run: cargo build --lib --release
- name: "cargo test (release)"
run: cargo test --bins --release
tests-other-channels:
name: "Tests, unstable toolchain"
runs-on: "ubuntu-24.04"
container: "ghcr.io/trusted-execution-clusters/buildroot:fedora"
continue-on-error: true
strategy:
matrix:
channel: [beta, nightly]
steps:
- name: "Check out repository"
uses: actions/checkout@v6
- name: "Install toolchain"
uses: dtolnay/rust-toolchain@v1
with:
toolchain: ${{ matrix.channel }}
components: rustfmt
- name: "Install Go toolchain"
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: "Cache build artifacts"
uses: Swatinem/rust-cache@v2
- name: "Build CRDs"
run: make crds-rs
- name: "cargo build"
run: cargo build --lib
- name: "cargo test"
run: cargo test --bins