forked from ostreedev/ostree-rs-ext
-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (154 loc) · 4.63 KB
/
rust.yml
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
# Inspired by https://github.com/rust-analyzer/rust-analyzer/blob/master/.github/workflows/ci.yaml
# but tweaked in several ways. If you make changes here, consider doing so across other
# repositories in e.g. ostreedev etc.
name: Rust
permissions:
actions: read
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: {}
env:
CARGO_TERM_COLOR: always
# Minimum supported Rust version (MSRV)
ACTION_MSRV_TOOLCHAIN: 1.58.1
# Pinned toolchain for linting
ACTION_LINTS_TOOLCHAIN: 1.58.1
jobs:
tests:
runs-on: ubuntu-latest
container: quay.io/coreos-assembler/fcos-buildroot:testing-devel
steps:
- uses: actions/checkout@v2
- name: Install deps
run: ./ci/installdeps.sh
# xref containers/containers-image-proxy-rs
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
with:
key: "tests"
- name: Build
run: cargo test --no-run
- name: Run tests
run: cargo test -- --nocapture --quiet
build:
runs-on: ubuntu-latest
container: quay.io/coreos-assembler/fcos-buildroot:testing-devel
steps:
- uses: actions/checkout@v2
- name: Install deps
run: ./ci/installdeps.sh
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
with:
key: "build"
- name: Build
run: cargo build --release
- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: ostree-ext-cli
path: target/release/ostree-ext-cli
build-minimum-toolchain:
name: "Build using MSRV"
runs-on: ubuntu-latest
container: quay.io/coreos-assembler/fcos-buildroot:testing-devel
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install deps
run: ./ci/installdeps.sh
- name: Remove system Rust toolchain
run: dnf remove -y rust cargo
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env['ACTION_MSRV_TOOLCHAIN'] }}
default: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
with:
key: "min"
- name: cargo check
run: cargo check
cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
with:
log-level: warn
command: check bans sources licenses
linting:
name: "Lints, pinned toolchain"
runs-on: ubuntu-latest
container: quay.io/coreos-assembler/fcos-buildroot:testing-devel
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install deps
run: ./ci/installdeps.sh
- name: Remove system Rust toolchain
run: dnf remove -y rust cargo
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env['ACTION_LINTS_TOOLCHAIN'] }}
default: true
components: rustfmt, clippy
- name: cargo fmt (check)
run: cargo fmt -- --check -l
- name: cargo clippy (warnings)
run: cargo clippy -- -D warnings
integration:
name: "Integration"
needs: build
runs-on: ubuntu-latest
container: quay.io/coreos-assembler/fcos:testing-devel
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download ostree-ext-cli
uses: actions/download-artifact@v2
with:
name: ostree-ext-cli
- name: Install
run: install ostree-ext-cli /usr/bin && rm -v ostree-ext-cli
- name: Integration tests
run: ./ci/integration.sh
ima:
name: "Integration (IMA)"
needs: build
runs-on: ubuntu-latest
container: quay.io/coreos-assembler/fcos:testing-devel
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download ostree-ext-cli
uses: actions/download-artifact@v2
with:
name: ostree-ext-cli
- name: Install
run: install ostree-ext-cli /usr/bin && rm -v ostree-ext-cli
- name: Integration tests
run: ./ci/ima.sh
privtest:
name: "Privileged testing"
needs: build
runs-on: ubuntu-latest
container:
image: quay.io/coreos-assembler/fcos:testing-devel
options: "--privileged -v /:/run/host"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download
uses: actions/download-artifact@v2
with:
name: ostree-ext-cli
- name: Install
run: install ostree-ext-cli /usr/bin && rm -v ostree-ext-cli
- name: Integration tests
run: ./ci/priv-integration.sh