-
Notifications
You must be signed in to change notification settings - Fork 1
186 lines (164 loc) · 5.79 KB
/
sterile-build-and-test.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# This is a sterile build and test workflow that uses the `dev-env` container image
# to build and test the project in a sterile environment.
# Artifacts produced by this workflow are intended to be used for production.
name: Sterile build + test
on:
push:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run with tmate enabled"
required: false
default: false
concurrency:
group: ${{ github.workflow }}:${{ github.ref }}
cancel-in-progress: true
jobs:
test:
permissions:
contents: read
packages: read
id-token: write
runs-on: lab
strategy:
fail-fast: false
matrix:
rust:
- stable
steps:
- name: login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: install rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: x86_64-unknown-linux-gnu
- uses: cargo-bins/cargo-binstall@main
- name: install just
run: cargo binstall --no-confirm just
- name: Checkout
uses: actions/checkout@v4
- name: dev/gnu sterile test
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
just rust="${{matrix.rust}}" profile=dev target=x86_64-unknown-linux-gnu sterile test
mkdir dev.gnu
cp -a ./target/nextest dev.gnu
- name: release/gnu sterile test
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
just rust="${{matrix.rust}}" profile=release target=x86_64-unknown-linux-gnu sterile test
mkdir release.gnu
cp -a ./target/nextest release.gnu
- name: dev/musl sterile test
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
just rust="${{matrix.rust}}" profile=dev target=x86_64-unknown-linux-musl sterile test
mkdir dev.musl
cp -a ./target/nextest dev.musl
- name: release/musl sterile test
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
just rust="${{matrix.rust}}" profile=release target=x86_64-unknown-linux-musl sterile test
mkdir release.musl
cp -a ./target/nextest release.musl
- name: install markdown-test-report
if: ${{ always() }}
run: |
sudo apt-get update
sudo apt-get --yes --no-install-recommends install \
colorized-logs \
libssl-dev \
openssl \
pkg-config
cargo binstall --no-confirm markdown-test-report
- name: dev/gnu report
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
export CARGO_TARGET_DIR=dev.gnu
just rust="${{matrix.rust}}" profile=dev target=x86_64-unknown-linux-gnu report
- name: dev/musl report
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
export CARGO_TARGET_DIR=dev.musl
just rust="${{matrix.rust}}" profile=dev target=x86_64-unknown-linux-musl report
- name: release/gnu report
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
export CARGO_TARGET_DIR=release.gnu
just rust="${{matrix.rust}}" profile=release target=x86_64-unknown-linux-gnu report
- name: release/musl report
if: ${{ always() }}
run: |
export GITHUB_STEP_SUMMARY
export CARGO_TARGET_DIR=release.musl
just rust="${{matrix.rust}}" profile=release target=x86_64-unknown-linux-musl report
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: 'rust-${{matrix.rust}}-test-results'
path: target/nextest
- name: Setup tmate session for debug
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
with:
limit-access-to-actor: true
push:
permissions:
contents: read
packages: write
id-token: write
runs-on: lab
strategy:
fail-fast: false
matrix:
rust:
- stable
steps:
- name: login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: install rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: x86_64-unknown-linux-gnu
- uses: cargo-bins/cargo-binstall@main
- name: install just
run: cargo binstall --no-confirm just
- name: Checkout
uses: actions/checkout@v4
- name: install rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
targets: x86_64-unknown-linux-gnu
- uses: cargo-bins/cargo-binstall@main
- run: cargo binstall --no-confirm cargo-deny
- run: just cargo deny check
- run: just rust="${{matrix.rust}}" profile=debug target=x86_64-unknown-linux-gnu push-container
- run: just rust="${{matrix.rust}}" profile=release target=x86_64-unknown-linux-gnu push-container
- run: just rust="${{matrix.rust}}" profile=debug target=x86_64-unknown-linux-musl push-container
- run: just rust="${{matrix.rust}}" profile=release target=x86_64-unknown-linux-musl push-container
- name: Setup tmate session for debug
if: ${{ failure() && github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 30
with:
limit-access-to-actor: true