-
-
Notifications
You must be signed in to change notification settings - Fork 4
565 lines (508 loc) · 26.5 KB
/
rust-musl.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
on:
push:
paths:
- ".github/workflows/rust-musl.yml"
- "Dockerfile.musl-base"
- "test/multicrate/**"
branches:
- main
workflow_dispatch:
inputs:
nightly_date:
description: "Nightly date to build"
required: false
default: ""
fresh_stable:
description: "Trigger new stable build"
required: false
default: ""
schedule:
- cron: '30 9 * * *' # everyday at 09:30 UTC
## ##
## To trigger this workflow using `act` (https://github.com/nektos/act) you can do the following.
## Full run no/different rustc_hash: (This triggers a fresh stable, since the rustc_hash is not available)
## act push -e <(echo '{"inputs":{"nightly_date":"","fresh_stable":""}}') -j musl-base
##
## Full run with same rustc_hash: (Get the current rustc_hash either from the output of the rust_stable step, or running rustc -vV your self)
## act push -e <(echo '{"inputs":{"nightly_date":"","fresh_stable":""}}') --env RUSTC_STABLE_HASH_ACT=f1edd0429 -j musl-base
##
## Nightly dispatch:
## act workflow_dispatch -e <(echo '{"action":"workflow_dispatch", "inputs":{"nightly_date":"","fresh_stable":""}}') -j musl-base
##
## Nightly dispatch specific date:
## act workflow_dispatch -e <(echo '{"action":"workflow_dispatch", "inputs":{"nightly_date":"2012-12-03","fresh_stable":""}}') -j musl-base
##
## Stable and Nightly dispatch:
## act workflow_dispatch -e <(echo '{"action":"workflow_dispatch", "inputs":{"nightly_date":"","fresh_stable":"true"}}') -j musl-base
##
## To only see the outputs from the build_vars to see what is getting triggered, use the same commands as above but replace `musl-base` with `build_vars`
## ##
name: Rust MUSL
jobs:
build_vars:
name: Generate Build Variables
runs-on: ubuntu-latest
outputs:
current_date: ${{ steps.build_vars.outputs.current_date }}
nightly_date: ${{ steps.build_vars.outputs.nightly_date }}
nightly_tag_postfix: ${{ steps.build_vars.outputs.nightly_tag_postfix }}
nightly_trigger: ${{ steps.build_vars.outputs.nightly_trigger }}
stable_trigger: ${{ steps.build_vars.outputs.stable_trigger }}
#
# Set versions extacted during the rust_versions step
stable_version: ${{ steps.rust_versions.outputs.stable_version }}
stable_semver: ${{ steps.rust_versions.outputs.stable_semver }}
# We also append the value of workflow input fresh_stable here.
# This will ensure we do trigger a fresh rustup.
stable_hash: "${{ steps.rust_versions.outputs.stable_hash }}${{ github.event.inputs.fresh_stable }}"
#
# Nightly version
nightly_version: ${{ steps.rust_versions.outputs.nightly_version }}
nightly_semver: ${{ steps.rust_versions.outputs.nightly_semver }}
#
# Special version to match the vaultwarden stable version currently used in master
vaultwarden_version: ${{ steps.rust_versions.outputs.vaultwarden_version }}
vaultwarden_semver: ${{ steps.rust_versions.outputs.vaultwarden_semver }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Stable Rust Toolchain
uses: dtolnay/rust-toolchain@4f647fc679bcd3b11499ccb42104547c83dabe96 # stable @ Nov 18, 2024, 5:36 AM GMT+1
- name: Get Rust version info
id: rust_versions
run: |
#
function github_output () {
echo "${1}=${2}" | tee -a "${GITHUB_OUTPUT}"
}
# Get the Rust stable version info
STABLE_VERSION_STRING=$(rustc -V)
STABLE_VERSION=$(echo "${STABLE_VERSION_STRING}" | grep -oP '\S+\s(\K\S+)(?=\s)')
github_output "stable_version" "${STABLE_VERSION}"
STABLE_HASH=$(echo "${STABLE_VERSION_STRING}" | grep -oP '\s\((\K\S+)(?=\s)')
github_output "stable_hash" "${STABLE_HASH}"
STABLE_SEMVER=${STABLE_VERSION//.}
github_output "stable_semver" "${STABLE_SEMVER}"
# Get the Rust nightly version info
rustup install --profile minimal nightly
NIGHTLY_VERSION_STRING=$(rustc +nightly -V)
NIGHTLY_VERSION=$(echo "${NIGHTLY_VERSION_STRING}" | grep -oP '\S+\s(\K\S+)(?=\s)')
github_output "nightly_version" "${NIGHTLY_VERSION}"
NIGHTLY_HASH=$(echo "${NIGHTLY_VERSION_STRING}" | grep -oP '\s\((\K\S+)(?=\s)')
github_output "nightly_hash" "${NIGHTLY_HASH}"
NIGHTLY_SEMVER=$(echo "${NIGHTLY_VERSION//.}" | grep -oP '(\K\d{4})')
github_output "nightly_semver" "${NIGHTLY_SEMVER}"
# Get the Vaultwarden Rust version from the `rust-toolchain` or `rust-toolchain.toml` file.
VW_RUST_VER="UNKNOWN"
CODE="$(curl -sSL -w '%{http_code}' -o /tmp/rust-toolchain https://raw.githubusercontent.com/dani-garcia/vaultwarden/main/rust-toolchain)"
if [[ "$CODE" =~ ^2 ]]; then
VW_RUST_VER="$(cat /tmp/rust-toolchain)"
elif [[ "$CODE" = 404 ]]; then
CODE="$(curl -sSL -w '%{http_code}' -o /tmp/rust-toolchain.toml https://raw.githubusercontent.com/dani-garcia/vaultwarden/main/rust-toolchain.toml)"
if [[ "$CODE" =~ ^2 ]]; then
VW_RUST_VER="$(grep -oP 'channel.*"(\K.*?)(?=")' /tmp/rust-toolchain.toml)"
fi
fi
# Check if the version matches X.YY.Z, if not use the STABLE_VERSION instead
if [[ "${VW_RUST_VER}" =~ ^[0-9]{1}\.[0-9]{2}\.[0-9]{1}$ ]]; then
github_output "vaultwarden_version" "${VW_RUST_VER}"
VAULTWARDEN_SEMVER=${VW_RUST_VER//.}
github_output "vaultwarden_semver" "${VAULTWARDEN_SEMVER}"
else
github_output "vaultwarden_version" "${STABLE_VERSION}"
github_output "vaultwarden_semver" "${STABLE_SEMVER}"
fi
- name: Cache previous rustc stable hash
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
if: ${{ !env.ACT }}
with:
path: ~/rustc-stable.hash
key: build-vars-rustc-stable-${{ steps.rust_versions.outputs.stable_hash }}
restore-keys: |
build-vars-rustc-stable-
# Check if this is a scheduled job, if so, set to nightly
- name: Get build variables
id: build_vars
run: |
#
function github_output () {
echo "${1}=${2}" | tee -a "${GITHUB_OUTPUT}"
}
#
# Date
export DATE=$(date +'%Y-%m-%d')
github_output "current_date" "${DATE}"
#
# Since `act` doesn't support actions/cache (yet) we check some env vars here.
# With this we can fake the cache if we want to so we can test the flow.
if [[ -n "${{ env.RUSTC_STABLE_HASH_ACT }}" ]]; then
echo "Found RUSTC_STABLE_HASH_ACT"
echo "${{ env.RUSTC_STABLE_HASH_ACT }}" | tee ~/rustc-stable.hash
fi
#
# Determine if we need to update the stable version
export RUSTC_STABLE_HASH_CACHED="$( cat ~/rustc-stable.hash 2>/dev/null )"
if [[ -n "${{ github.event.inputs.fresh_stable }}" ]]; then
github_output "stable_trigger" "true"
elif [[ "${RUSTC_STABLE_HASH_CACHED}" != ${{ steps.rust_versions.outputs.stable_hash }} ]]; then
echo "Cached: '${RUSTC_STABLE_HASH_CACHED}' - Current: '${{ steps.rust_versions.outputs.stable_hash }}'"
github_output "stable_trigger" "true"
else
github_output "stable_trigger" ""
fi
# Store the current stable hash in GHA Cache
echo "${{ steps.rust_versions.outputs.stable_hash }}" | tee ~/rustc-stable.hash
#
# Determine nightly date
# If this is triggered by a workflow dispatch and a date is filled use that, else use the current date
if [[ -z "${{ github.event.inputs.nightly_date }}" ]]; then
github_output "nightly_date" "${DATE}"
# Set an empty nightly_tag_postfix because we are building the current nightly
github_output "nightly_tag_postfix" ""
# When there is a custom nightly_date set, lets first validate it.
elif [[ "${{ github.event.inputs.nightly_date }}" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] \
&& date +'%Y-%m-%d' -d'${{ github.event.inputs.nightly_date }}' >/dev/null 2>&1 \
&& [[ $(date +%s -d "00:00:00") -ge $(date +%s -d'${{ github.event.inputs.nightly_date }}') ]] ; then
github_output "nightly_date" "${{ github.event.inputs.nightly_date }}"
# To prevent tagging an older nightly version, we set a postfix here which is used by the nightly build/push action
github_output "nightly_tag_postfix" "-${{ github.event.inputs.nightly_date }}"
# If there was a workflow run, and it had an invalid date, stop the whole workflow
else
echo "error::Invalid nightly_date"
echo "::error::Invalid nightly_date"
exit 1
fi
#
# Check if we want to build a nightly only.
# We want this either when the cron is triggered
# Or if we trigger a manual workflow
if [[ "${{ github.event_name }}" == 'workflow_dispatch' ]] || [[ "${{ github.event.schedule }}" == '30 9 * * *' ]]; then
github_output "nightly_trigger" "true"
else
github_output "nightly_trigger" ""
fi
# ###
# Building the final MUSL Based images including the rust toolchain.
musl-base:
name: Build MUSL Base Image - ${{ matrix.env.IMAGE_TAG }}
needs: [build_vars]
runs-on: ubuntu-latest
env:
HAVE_DOCKERHUB_LOGIN: ${{ vars.DOCKERHUB_ENABLED == 'true' && secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
HAVE_GHCR_LOGIN: ${{ vars.GHCR_ENABLED == 'true' && github.repository_owner != '' && secrets.GITHUB_TOKEN != '' }}
HAVE_QUAY_LOGIN: ${{ vars.QUAY_ENABLED == 'true' && secrets.QUAY_USERNAME != '' && secrets.QUAY_TOKEN != '' }}
if: ${{ github.repository == 'BlackDex/rust-musl' }}
strategy:
# max-parallel: 1 # Use this when using `act`, since this could use a lot of memory or cause other issues
fail-fast: false
matrix:
env:
- IMAGE_TAG: x86_64-musl
TARGET: x86_64-unknown-linux-musl
OPENSSL_ARCH: "linux-x86_64 enable-ec_nistp_64_gcc_128"
- IMAGE_TAG: armv7-musleabihf
TARGET: armv7-unknown-linux-musleabihf
OPENSSL_ARCH: linux-armv4
- IMAGE_TAG: aarch64-musl
TARGET: aarch64-unknown-linux-musl
OPENSSL_ARCH: linux-aarch64
# The aarch64 musl does not support outline-atomics and needs to be disabled
# We need to provide some extra CPPFLAGS to prevent errors during the compilation of the Rust project
ARCH_CPPFLAGS: "-mno-outline-atomics"
- IMAGE_TAG: arm-musleabi
TARGET: arm-unknown-linux-musleabi
OPENSSL_ARCH: linux-armv4
# XTRA_RUSTFLAGS: "-Clink-args=-latomic "
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# This action is messing with the host caching when using `act`
- name: Setup Docker Buildx (setup-buildx-action)
if: ${{ !env.ACT }}
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
# https://github.com/moby/buildkit/issues/3969
with:
driver-opts: |
network=host
# Use the DOCKER_BUILDKIT=1 env when using `act`
- name: Setup Docker Buildx (DOCKER_BUILDKIT=1)
if: ${{ env.ACT }}
shell: bash
run: |
echo "DOCKER_BUILDKIT=1" | tee -a "${GITHUB_ENV}"
- name: Generate base container tags
shell: bash
run: |
echo "base_tags_stable=" \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}," \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-${{ needs.build_vars.outputs.stable_version }}," \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-stable," \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-stable-${{ needs.build_vars.outputs.stable_version }}," \
| tr -d ' ' | tee -a "${GITHUB_ENV}"
echo "base_tags_stable_vw=" \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-${{ needs.build_vars.outputs.vaultwarden_version }}," \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-stable-${{ needs.build_vars.outputs.vaultwarden_version }}," \
| tr -d ' ' | tee -a "${GITHUB_ENV}"
echo "base_tags_nightly=" \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-nightly${{ needs.build_vars.outputs.nightly_tag_postfix }}," \
"@RGSTRY@blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-nightly-${{ needs.build_vars.outputs.nightly_date }}," \
| tr -d ' ' | tee -a "${GITHUB_ENV}"
- name: Login to DockerHub
if: ${{ env.HAVE_DOCKERHUB_LOGIN == 'true' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Tags for DockerHub
if: ${{ env.HAVE_DOCKERHUB_LOGIN == 'true' }}
shell: bash
run: |
echo "tags_stable=$(echo "${base_tags_stable}" | sed 's#@RGSTRY@#docker.io/#g')" \
| tee -a "${GITHUB_ENV}"
echo "tags_stable_vw=$(echo "${base_tags_stable_vw}" | sed 's#@RGSTRY@#docker.io/#g')" \
| tee -a "${GITHUB_ENV}"
echo "tags_nightly=$(echo "${base_tags_nightly}" | sed 's#@RGSTRY@#docker.io/#g')" \
| tee -a "${GITHUB_ENV}"
- name: Login to ghcr.io
if: ${{ env.HAVE_GHCR_LOGIN == 'true' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tags for ghcr.io
if: ${{ env.ACT || env.HAVE_GHCR_LOGIN == 'true' }}
shell: bash
run: |
echo "tags_stable=${tags_stable:+${tags_stable},}$(echo "${base_tags_stable}" | sed 's#@RGSTRY@#ghcr.io/#g')" \
| tee -a "${GITHUB_ENV}"
echo "tags_stable_vw=${tags_stable_vw:+${tags_stable_vw},}$(echo "${base_tags_stable_vw}" | sed 's#@RGSTRY@#ghcr.io/#g')" \
| tee -a "${GITHUB_ENV}"
echo "tags_nightly=${tags_nightly:+${tags_nightly},}$(echo "${base_tags_nightly}" | sed 's#@RGSTRY@#ghcr.io/#g')" \
| tee -a "${GITHUB_ENV}"
- name: Login to quay.io
if: ${{ env.HAVE_QUAY_LOGIN == 'true' }}
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Tags for quay.io
if: ${{ env.HAVE_QUAY_LOGIN == 'true' }}
shell: bash
run: |
echo "tags_stable=${tags_stable:+${tags_stable},}$(echo "${base_tags_stable}" | sed 's#@RGSTRY@#quay.io/#g')" \
| tee -a "${GITHUB_ENV}"
echo "tags_stable_vw=${tags_stable_vw:+${tags_stable_vw},}$(echo "${base_tags_stable_vw}" | sed 's#@RGSTRY@#quay.io/#g')" \
| tee -a "${GITHUB_ENV}"
echo "tags_nightly=${tags_nightly:+${tags_nightly},}$(echo "${base_tags_nightly}" | sed 's#@RGSTRY@#quay.io/#g')" \
| tee -a "${GITHUB_ENV}"
- name: Determine Docker Build Cache
id: docker_cache
run: |
#
function github_output () {
echo "${1}=${2}" | tee -a "${GITHUB_OUTPUT}"
}
#
# Check if we are running this via act or not and determine the caching method
if [[ -n "${ACT}" ]]; then
github_output "cache_from" "blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}"
github_output "cache_to" ""
else
github_output "cache_from" "type=gha,scope=${{ matrix.env.IMAGE_TAG }}"
github_output "cache_to" "type=gha,scope=${{ matrix.env.IMAGE_TAG }}"
fi
#
# ###
# Rust Current Stable
- name: Docker Build - Rust Current Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
# Set load to true so that we can test the builded image in the next step
load: ${{ !env.ACT }}
# Do not push the image just yet, we first want to test it
push: false
file: ./Dockerfile.musl-base
build-args: |
TARGET=${{ matrix.env.TARGET }}
IMAGE_TAG=${{ matrix.env.IMAGE_TAG }}
OPENSSL_ARCH=${{ matrix.env.OPENSSL_ARCH }}
ARCH_CPPFLAGS=${{ matrix.env.ARCH_CPPFLAGS }}
RUST_CHANNEL=stable
RUSTC_HASH=${{ needs.build_vars.outputs.stable_hash }}
tags: blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-test
cache-from: ${{ steps.docker_cache.outputs.cache_from }}
cache-to: ${{ steps.docker_cache.outputs.cache_to }}
- name: Test Docker Image - Rust Current Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger }}
run: |
# Run the test
docker run --rm \
-v cargo-cache-${{ matrix.env.IMAGE_TAG }}:/root/.cargo/registry \
-v "$(pwd)/test/multicrate":/home/rust/src \
--tmpfs /home/rust/src/target:rw,exec,mode=1777 \
-e RUST_BACKTRACE=1 \
-e RUSTFLAGS="${{ matrix.env.XTRA_RUSTFLAGS }}-Clink-arg=-s" \
blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-test bash -c 'rm -vf Cargo.lock ; cargo -Vv ; rustc -Vv ; cargo update ; cargo build --release'
- name: Test Docker Image (PQ15) - Rust Current Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger }}
# continue-on-error: true
run: |
# Run the test
docker run --rm \
-v cargo-cache-${{ matrix.env.IMAGE_TAG }}:/root/.cargo/registry \
-v "$(pwd)/test/multicrate":/home/rust/src \
--tmpfs /home/rust/src/target:rw,exec,mode=1777 \
-e RUST_BACKTRACE=1 \
-e PQ_LIB_DIR="/usr/local/musl/pq15/lib" \
-e RUSTFLAGS="${{ matrix.env.XTRA_RUSTFLAGS }}-Clink-arg=-s" \
blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-test bash -c 'rm -vf Cargo.lock ; cargo -Vv ; rustc -Vv ; cargo update ; cargo build --release'
- name: Docker Push - Rust Current Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
# Run this step also when using `act`, but do not push the images when build locally
push: ${{ !env.ACT }}
file: ./Dockerfile.musl-base
build-args: |
TARGET=${{ matrix.env.TARGET }}
IMAGE_TAG=${{ matrix.env.IMAGE_TAG }}
OPENSSL_ARCH=${{ matrix.env.OPENSSL_ARCH }}
ARCH_CPPFLAGS=${{ matrix.env.ARCH_CPPFLAGS }}
RUST_CHANNEL=stable
RUSTC_HASH=${{ needs.build_vars.outputs.stable_hash }}
tags: ${{ env.tags_stable }}
cache-from: ${{ steps.docker_cache.outputs.cache_from }}
cache-to: ${{ steps.docker_cache.outputs.cache_to }}
# ###
# Rust Vaultwarden Stable
- name: Docker Build - Rust Vaultwarden Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_version != needs.build_vars.outputs.vaultwarden_version && (needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger) }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
# Set load to true so that we can test the builded image in the next step
load: ${{ !env.ACT }}
# Do not push the image just yet, we first want to test it
push: false
file: ./Dockerfile.musl-base
build-args: |
TARGET=${{ matrix.env.TARGET }}
IMAGE_TAG=${{ matrix.env.IMAGE_TAG }}
OPENSSL_ARCH=${{ matrix.env.OPENSSL_ARCH }}
ARCH_CPPFLAGS=${{ matrix.env.ARCH_CPPFLAGS }}
RUST_CHANNEL=${{ needs.build_vars.outputs.vaultwarden_version }}
tags: blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-vw-test
cache-from: ${{ steps.docker_cache.outputs.cache_from }}
cache-to: ${{ steps.docker_cache.outputs.cache_to }}
- name: Test Docker Image - Rust Vaultwarden Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_version != needs.build_vars.outputs.vaultwarden_version && (needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger) }}
run: |
# Run the test
docker run --rm \
-v cargo-cache:/root/.cargo/registry \
-v "$(pwd)/test/multicrate":/home/rust/src \
--tmpfs /home/rust/src/target:rw,exec,mode=1777 \
-e RUST_BACKTRACE=1 \
-e RUSTFLAGS="${{ matrix.env.XTRA_RUSTFLAGS }}-Clink-arg=-s" \
blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-vw-test bash -c 'rm -vf Cargo.lock ; cargo -Vv ; rustc -Vv ; cargo update ; cargo build --release'
- name: Test Docker Image (PQ15) - Rust Vaultwarden Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_version != needs.build_vars.outputs.vaultwarden_version && (needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger) }}
# continue-on-error: true
run: |
# Run the test
docker run --rm \
-v cargo-cache:/root/.cargo/registry \
-v "$(pwd)/test/multicrate":/home/rust/src \
--tmpfs /home/rust/src/target:rw,exec,mode=1777 \
-e RUST_BACKTRACE=1 \
-e PQ_LIB_DIR="/usr/local/musl/pq15/lib" \
-e RUSTFLAGS="${{ matrix.env.XTRA_RUSTFLAGS }}-Clink-arg=-s" \
blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-vw-test bash -c 'rm -vf Cargo.lock ; cargo -Vv ; rustc -Vv ; cargo update ; cargo build --release'
- name: Docker Push - Rust Vaultwarden Stable
# Skip during nightly builds
if: ${{ needs.build_vars.outputs.stable_version != needs.build_vars.outputs.vaultwarden_version && (needs.build_vars.outputs.stable_trigger || !needs.build_vars.outputs.nightly_trigger) }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
# Run this step also when using `act`, but do not push the images when build locally
push: ${{ !env.ACT }}
file: ./Dockerfile.musl-base
build-args: |
TARGET=${{ matrix.env.TARGET }}
IMAGE_TAG=${{ matrix.env.IMAGE_TAG }}
OPENSSL_ARCH=${{ matrix.env.OPENSSL_ARCH }}
ARCH_CPPFLAGS=${{ matrix.env.ARCH_CPPFLAGS }}
RUST_CHANNEL=${{ needs.build_vars.outputs.vaultwarden_version }}
tags: ${{ env.tags_stable_vw }}
cache-from: ${{ steps.docker_cache.outputs.cache_from }}
cache-to: ${{ steps.docker_cache.outputs.cache_to }}
# ###
# Rust Nightly
- name: Docker Build - Rust Nightly
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
# Set load to true so that we can test the builded image in the next step
load: ${{ !env.ACT }}
# Do not push the image just yet, we first want to test it
push: false
file: ./Dockerfile.musl-base
build-args: |
TARGET=${{ matrix.env.TARGET }}
IMAGE_TAG=${{ matrix.env.IMAGE_TAG }}
OPENSSL_ARCH=${{ matrix.env.OPENSSL_ARCH }}
ARCH_CPPFLAGS=${{ matrix.env.ARCH_CPPFLAGS }}
RUST_CHANNEL=nightly-${{ needs.build_vars.outputs.nightly_date }}
tags: blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-nightly-test
cache-from: ${{ steps.docker_cache.outputs.cache_from }}
cache-to: ${{ steps.docker_cache.outputs.cache_to }}
- name: Test Docker Image - Rust Nightly
run: |
# Run the test
docker run --rm \
-v cargo-cache:/root/.cargo/registry \
-v "$(pwd)/test/multicrate":/home/rust/src \
--tmpfs /home/rust/src/target:rw,exec,mode=1777 \
-e RUST_BACKTRACE=1 \
-e RUSTFLAGS="${{ matrix.env.XTRA_RUSTFLAGS }}-Clink-arg=-s" \
blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-nightly-test bash -c 'rm -vf Cargo.lock ; cargo -Vv ; rustc -Vv ; cargo update ; cargo build --release'
- name: Test Docker Image (PQ15) - Rust Nightly
# continue-on-error: true
run: |
# Run the test
docker run --rm \
-v cargo-cache:/root/.cargo/registry \
-v "$(pwd)/test/multicrate":/home/rust/src \
--tmpfs /home/rust/src/target:rw,exec,mode=1777 \
-e RUST_BACKTRACE=1 \
-e PQ_LIB_DIR="/usr/local/musl/pq15/lib" \
-e RUSTFLAGS="${{ matrix.env.XTRA_RUSTFLAGS }}-Clink-arg=-s" \
blackdex/rust-musl:${{ matrix.env.IMAGE_TAG }}-nightly-test bash -c 'rm -vf Cargo.lock ; cargo -Vv ; rustc -Vv ; cargo update ; cargo build --release'
- name: Docker Push - Rust Nightly
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
# Run this step also when using `act`, but do not push the images when build locally
push: ${{ !env.ACT }}
file: ./Dockerfile.musl-base
build-args: |
TARGET=${{ matrix.env.TARGET }}
IMAGE_TAG=${{ matrix.env.IMAGE_TAG }}
OPENSSL_ARCH=${{ matrix.env.OPENSSL_ARCH }}
ARCH_CPPFLAGS=${{ matrix.env.ARCH_CPPFLAGS }}
RUST_CHANNEL=nightly-${{ needs.build_vars.outputs.nightly_date }}
tags: ${{ env.tags_nightly }}
cache-from: ${{ steps.docker_cache.outputs.cache_from }}
cache-to: ${{ steps.docker_cache.outputs.cache_to }}