-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (71 loc) · 2.37 KB
/
build.yml
File metadata and controls
84 lines (71 loc) · 2.37 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
# A callable workflow for CLI builds
# Stores the build artifact at the given artifact ID
---
name: Build
on:
workflow_call:
inputs:
artifactId:
description: The artifact ID used to store the build artifact with actions/upload-artifact
type: string
required: true
runsOn:
description: The runner to run the workflow on
type: string
default: ubuntu-latest
ref:
description: the git ref to checkout from cloudtruth-cli
type: string
buildOptions:
description: options to pass to the Cargo build
type: string
default: --all-features --workspace --lib --bins --tests
testOptions:
description: options to pass to the Cargo tests
type: string
default: --all-features --workspace --lib --bins
rustCacheKey:
description: cache ID to use for rust-cache
type: string
default: v0-cloudtruth
env:
CI: true
ARCHIVE_FILE: integration-test-archive.tar.zst
RUST_BACKTRACE: 1
jobs:
build:
name: CLI Build
runs-on: ${{ inputs.runsOn }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- run: sh cicd/scripts/install-rust.sh
- uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ inputs.rustCacheKey }}
- uses: taiki-e/install-action@cargo-nextest
- name: Clean Debug Files
if: ${{ !contains(runner.os, 'Linux') }}
run: sh ./cicd/scripts/clean-debug-info.sh
- name: Build and Create Test Archive
env:
RUSTFLAGS: ${{ contains(runner.os, 'macOS') && '-C split-debuginfo=packed' || '' }}
run: cargo nextest archive ${{ inputs.buildOptions }} --archive-file $ARCHIVE_FILE
- name: Add Debug Files to Test Archive
if: ${{ !contains(runner.os, 'Linux') }}
run: sh ./cicd/scripts/archive-debug-info.sh "$ARCHIVE_FILE"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifactId }}
if-no-files-found: ignore
path: |
./integration-test-archive.tar.zst
- name: Unit Tests
env:
RUSTFLAGS: ${{ contains(runner.os, 'macOS') && '-C split-debuginfo=packed' || '' }}
run: cargo nextest run --profile ci ${{ inputs.testOptions }}