-
Notifications
You must be signed in to change notification settings - Fork 186
102 lines (91 loc) · 3.35 KB
/
build-one.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
name: build-one
on:
workflow_call:
inputs:
build:
description: "Name output for the build"
required: true
type: string
app_name:
description: "Application directory name"
required: true
type: string
app_toml:
description: "TOML file name (must be app directory)"
required: true
type: string
image:
description: "Comma separated string of image names to build"
required: true
type: string
os:
description: "OS to build for"
required: true
type: string
jobs:
build-one:
permissions:
id-token: write
attestations: write
name: "${{ inputs.app_name }}/${{ inputs.app_toml}}"
runs-on: ${{ inputs.os }}
env:
VCPKGRS_DYNAMIC: 1
steps:
# check out our code
- uses: actions/checkout@v4
# install rust toolchain
- name: Install Rust toolchain
run: |
rustup show
rustup component add clippy
- name: Cache build output
uses: Swatinem/rust-cache@v2
- name: Cache vcpkg
uses: actions/cache@v4
with:
path: C:\vcpkg\downloads
key: ${{ runner.os }}-vcpkg-download-${{ inputs.os }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-vcpkg-download-${{ inputs.os }}-
${{ runner.os }}-vcpkg-download-
# invoke our build
- name: cargo xtask dist
env:
RUST_BACKTRACE: 1
run: cargo xtask dist ${{ inputs.app_toml}}
- name: Fetch Humility
uses: dsaltares/fetch-gh-release-asset@master
if: inputs.os == 'ubuntu-latest' || inputs.os == 'oxide-colo-builder-hubris'
with:
repo: "oxidecomputer/humility"
version: "59047694"
file: "humility"
target: "target/release/humility"
- name: Test Humility manifest
# we need to chmod because all artifacts are marked as non-executable
if: inputs.os == 'ubuntu-latest' || inputs.os == 'oxide-colo-builder-hubris'
run: |
sudo apt-get update && sudo apt-get install -y libusb-1.0-0-dev libftdi1-dev
sudo chmod +x target/release/humility
for image in `echo ${{ inputs.image }} | tr "," "\n"`; do \
mv target/${{ inputs.app_name }}/dist/$image/build-${{ inputs.app_name }}-image-$image.zip target/${{ inputs.app_name }}/dist/; \
target/release/humility -a target/${{ inputs.app_name }}/dist/build-${{ inputs.app_name }}-image-$image.zip manifest; \
done
- name: Clippy
if: inputs.os == 'ubuntu-latest'
run: |
cargo xtask clippy ${{ inputs.app_toml}} -- --deny warnings
- name: Attestation
uses: actions/attest-build-provenance@v1
# Only attest if we're doing a colo build
if: inputs.os == 'oxide-colo-builder-hubris'
with:
subject-path: target/${{ inputs.app_name }}/dist/build-${{ inputs.app_name }}-image-*.zip
# upload the output of our build
- name: Upload build archive
uses: actions/upload-artifact@v4
if: inputs.os == 'ubuntu-latest' || inputs.os == 'oxide-colo-builder-hubris'
with:
name: dist-${{ inputs.os }}-${{ inputs.app_name }}
path: target/${{ inputs.app_name }}/dist/build-${{ inputs.app_name }}-image-*.zip