-
Notifications
You must be signed in to change notification settings - Fork 7
239 lines (220 loc) · 8.44 KB
/
wit-deps.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
name: wit-deps
on:
pull_request:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-bin:
strategy:
matrix:
config:
- target: aarch64-unknown-linux-musl
install-path: /bin/wit-deps
test-bin: nix shell --inputs-from . 'nixpkgs#qemu' -c qemu-aarch64 ./result/bin/wit-deps --version
test-oci: docker load < ./result
# TODO: Run aarch64 binary within OCI
- target: aarch64-apple-darwin
install-path: /bin/wit-deps
test-bin: file ./result/bin/wit-deps
test-oci: docker load < ./result
- target: armv7-unknown-linux-musleabihf
install-path: /bin/wit-deps
test-bin: nix shell --inputs-from . 'nixpkgs#qemu' -c qemu-arm ./result/bin/wit-deps --version
test-oci: docker load < ./result
# TODO: Run armv7 binary within OCI
- target: x86_64-apple-darwin
install-path: /bin/wit-deps
test-bin: file ./result/bin/wit-deps
test-oci: docker load < ./result
- target: x86_64-pc-windows-gnu
install-path: /bin/wit-deps.exe
test-bin: nix shell --inputs-from . 'nixpkgs#wine64' -c wine64 ./result/bin/wit-deps.exe --version
test-oci: docker load < ./result
# TODO: Run windows binary within OCI
- target: x86_64-unknown-linux-musl
install-path: /bin/wit-deps
test-bin: ./result/bin/wit-deps --version
test-oci: |
docker load < ./result
docker run --rm wit-deps:$(nix eval --raw .#wit-deps-x86_64-unknown-linux-musl-oci.imageTag) wit-deps --version
name: wit-deps-${{ matrix.config.target }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: ./.github/actions/build-nix
with:
package: wit-deps-${{ matrix.config.target }}
install-path: ${{ matrix.config.install-path }}
- run: ${{ matrix.config.test-bin }}
- uses: ./.github/actions/build-nix
with:
package: wit-deps-${{ matrix.config.target }}-oci
- run: ${{ matrix.config.test-oci }}
build-lipo:
name: wit-deps-universal-darwin
needs: build-bin
runs-on: macos-12
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-aarch64-apple-darwin
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-x86_64-apple-darwin
- run: chmod +x ./wit-deps-x86_64-apple-darwin
- run: ./wit-deps-x86_64-apple-darwin --version
- run: lipo -create ./wit-deps-aarch64-apple-darwin ./wit-deps-x86_64-apple-darwin -output ./wit-deps-universal-darwin
- run: chmod +x ./wit-deps-universal-darwin
- run: ./wit-deps-universal-darwin --version
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: wit-deps-universal-darwin
path: wit-deps-universal-darwin
if-no-files-found: error
cargo:
strategy:
matrix:
check:
- audit
- fmt
- clippy
- nextest
name: cargo ${{ matrix.check }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L .#checks.x86_64-linux.${{ matrix.check }}
build-doc:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix build -L .#checks.x86_64-linux.doc
- run: cp --no-preserve=mode -R ./result/share/doc ./doc
- run: rm -f doc/.lock
- name: Create `.nojekyll`
run: touch doc/.nojekyll
- name: Write `index.html`
run: |
cat <<EOF > doc/index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>Redirecting to wit_deps/index.html</title>
<meta http-equiv="refresh" content="0; URL=wit_deps/index.html">
<link rel="canonical" href="https://${{ github.repository_owner }}.github.io/wit-deps/wit_deps/index.html">
EOF
- uses: actions/upload-pages-artifact@v3.0.1
with:
path: doc
deploy-doc:
runs-on: ubuntu-22.04
needs: build-doc
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/deploy-pages@v4.0.5
id: deployment
oci:
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' }}
needs: build-bin
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-nix
with:
cachixAuthToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
nix run -L .#build-wit-deps-oci wit-deps
nix profile install --inputs-from . 'nixpkgs#buildah'
buildah manifest push --all --format 'v2s2' wit-deps docker://ghcr.io/${{ github.repository_owner }}/wit-deps:${{ github.sha }}
docker run ghcr.io/${{ github.repository_owner }}/wit-deps:${{ github.sha }} wit-deps --version
release:
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
needs: [ build-bin, build-lipo, build-doc, cargo ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-aarch64-apple-darwin
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-aarch64-unknown-linux-musl
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-armv7-unknown-linux-musleabihf
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-universal-darwin
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-x86_64-apple-darwin
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-x86_64-pc-windows-gnu
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-x86_64-unknown-linux-musl
- run: chmod +x ./wit-deps-*
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-aarch64-apple-darwin-oci
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-aarch64-unknown-linux-musl-oci
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-armv7-unknown-linux-musleabihf-oci
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-x86_64-pc-windows-gnu-oci
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-x86_64-apple-darwin-oci
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: wit-deps-x86_64-unknown-linux-musl-oci
- uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: true
generate_release_notes: true
files: |
wit-deps-aarch64-apple-darwin
wit-deps-aarch64-apple-darwin-oci
wit-deps-aarch64-unknown-linux-musl
wit-deps-aarch64-unknown-linux-musl-oci
wit-deps-armv7-unknown-linux-musleabihf
wit-deps-armv7-unknown-linux-musleabihf-oci
wit-deps-universal-darwin
wit-deps-x86_64-apple-darwin
wit-deps-x86_64-apple-darwin-oci
wit-deps-x86_64-pc-windows-gnu
wit-deps-x86_64-pc-windows-gnu-oci
wit-deps-x86_64-unknown-linux-musl
wit-deps-x86_64-unknown-linux-musl-oci