-
Notifications
You must be signed in to change notification settings - Fork 173
194 lines (163 loc) · 6.14 KB
/
build-v2.yaml
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
name: Go Build and Test
on:
pull_request:
paths-ignore:
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"
- "CODEOWNERS"
jobs:
build-cli:
name: Build CLI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup golang
uses: ./.github/actions/golang
- name: Build CLI for all platforms
run: make build-cli
- name: Upload build artifacts (all the CLIs)
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: build-artifacts-cli
path: build/
retention-days: 1
- name: Upload build artifacts (just one for creating the packages CLI)
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: build-artifacts-cli-linux-amd64
path: build/zarf
retention-days: 1
build-injector:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Install Rust toolchain (this one is maintained)
uses: dtolnay/rust-toolchain@stable
- name: Build injector
run: |
cd src/injector
make build-injector-linux
- name: Upload build artifacts (injector)
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: build-artifacts-injector-amd64
path: src/injector/target/x86_64-unknown-linux-musl/release/zarf-injector
retention-days: 1
- name: Upload build artifacts (injector)
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: build-artifacts-injector-arm64
path: src/injector/target/aarch64-unknown-linux-musl/release/zarf-injector
retention-days: 1
build-packages:
name: Build packages
needs: build-cli
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
task: [build-examples, init-package]
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup golang
uses: ./.github/actions/golang
- name: Download build artifacts (cli)
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
#name: build-artifacts-cli-linux-amd64
name: build-artifacts-cli
path: build/
- name: Build init package for ${{ matrix.arch }}
run: |
chmod +x build/zarf
make ${{ matrix.task }} ARCH=${{ matrix.arch }}
- name: Upload build artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: build-artifacts-${{ matrix.task }}-${{ matrix.arch }}
path: build/*.zst
retention-days: 1
# not really necessary, this is done
- name: cleanup
run: rm -f build/*.zst
test-unit:
needs: build-packages
name: run unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
# for testing (with act), this will fail in the directory exists
- name: Download build artifacts (cli)
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
#name: build-artifacts-cli-linux-amd64
name: build-artifacts-cli
path: build-tmp/
# for testing (with act), this will fail in the directory exists
- name: Download build artifacts (example packages)
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts-build-examples-amd64
path: build-examples-tmp/
- name: Download build artifacts (init packages)
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts-init-package-amd64
path: build/
- name: move the zarf binary back to build where the tests/makefile expect it to be
run: |
mv ./build-tmp/zarf build
mv ./build-examples-tmp/* build
rm -rf ./build-examples-tmp
rm -rf ./build-tmp
chmod +x build/zarf
- name: Setup golang
uses: ./.github/actions/golang
# above here is what is needed to have packages, and run a test. for future, the following could not use the makefile to run tests if desired.
- name: Run the unit tests
run: make test-unit
test-windows:
needs: build-packages
name: run unit tests on windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup golang
uses: ./.github/actions/golang
# for testing (with act), this will fail in the directory exists
- name: Download build artifacts (cli)
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts-cli-windows-amd64
path: build-tmp/
# for testing (with act), this will fail in the directory exists
- name: Download build artifacts (example packages)
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts-build-examples-amd64
path: build-examples-tmp/
- name: Download build artifacts (init packages)
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts-init-package-amd64
path: build/
- name: Move the zarf binary back to build where the tests/makefile expect it to be
shell: pwsh
run: |
Move-Item -Path "./build-tmp/zarf" -Destination "build"
Move-Item -Path "./build-examples-tmp/*" -Destination "build"
Remove-Item -Recurse -Force "./build-examples-tmp"
Remove-Item -Recurse -Force "./build-tmp"
- name: Run Windows unit tests
run: make test-unit
shell: pwsh