-
Notifications
You must be signed in to change notification settings - Fork 0
288 lines (240 loc) · 8.18 KB
/
nix-build.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
name : Build
on:
push:
branches:
- main
paths-ignore:
- 'assets/**'
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- 'assets/**'
- '**.md'
concurrency:
group: ${{ github.ref_name }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
verify-flake:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Check Nix flake
run: nix flake check --all-systems
build-for-linux_x86_64:
name: build for linux_x86_64
runs-on: ubuntu-20.04
needs: [verify-flake]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for x86_64-unknown-linux-gnu
run: |
nix build .#termusix_x86_64-linux --show-trace --log-lines 10000
./result/bin/termusix --version
nix develop --command ./scripts/export-linux-bin.sh termusix ./binaries
- name : upload packages termusix-x86_64-linux
uses : actions/upload-artifact@v4
with :
name : termusix-x86_64-linux
path : binaries/termusix-x86_64-linux
build-for-arm-linux-and-windows:
name: build for linux arm and windows
runs-on: ubuntu-20.04
needs: [verify-flake]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for aarch64-unknown-linux-gnu
run: |
nix build .#termusix_aarch64-linux --show-trace --log-lines 10000
cp ./result/bin/termusix binaries/termusix-aarch64-linux
- name : upload packages termusix-aarch64-linux
uses : actions/upload-artifact@v4
with :
name : termusix-aarch64-linux
path : binaries/termusix-aarch64-linux
- name: Build termusix for x86_64-pc-windows-gnu
run: |
nix build .#termusix_x86_64-windows --show-trace --log-lines 10000
cp ./result/bin/termusix.exe binaries/termusix-x86_64-windows.exe
- name : upload packages termusix-x86_64-windows
uses : actions/upload-artifact@v4
with :
name : termusix-x86_64-windows
path : binaries/termusix-x86_64-windows.exe
build-for-apple-intel:
name: build for x86_64-apple-darwin
runs-on: macos-13
needs: [verify-flake]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for x86_64-apple-darwin
run: |
nix build .#termusix_x86_64-apple --show-trace --log-lines 10000
./result/bin/termusix --version
cp ./result/bin/termusix binaries/termusix-x86_64-apple
- name : upload packages termusix-x86_64-apple
uses : actions/upload-artifact@v4
with :
name : termusix-x86_64-apple
path : binaries/*
- name: tar the package for mac-intel
run: |
mkdir -p tar_folder
nix build .#tar-darwin-x86_64 --show-trace --log-lines 10000
cp ./result/* tar_folder/
- name: upload packages termusix-aarch64-apple
uses: actions/upload-artifact@v4
with:
name: termusix-x86_64-apple-tar
path: tar_folder/*
build-for-apple-arm:
name: build for apple Mac
runs-on: macos-latest
needs: [build-for-apple-intel]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/common-setup
with:
cachix_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build termusix for aarch64-apple-darwin
run: |
nix build .#termusix_aarch64-apple --show-trace --log-lines 10000
./result/bin/termusix --version
cp ./result/bin/termusix binaries/termusix-aarch64-apple
- name: upload packages termusix-aarch64-apple
uses: actions/upload-artifact@v4
with:
name: termusix-aarch64-apple
path: binaries/termusix-aarch64-apple
- name: tar the package for mac-arm
run: |
mkdir -p tar_arm
nix build .#tar-darwin-arm --show-trace --log-lines 10000
cp ./result/* tar_arm/
- name: upload packages termusix-aarch64-apple
uses: actions/upload-artifact@v4
with:
name: termusix-aarch64-apple-tar
path: tar_arm/*
- name: download tar artifact from darwin intel
uses: actions/download-artifact@v4
with:
name: termusix-x86_64-apple-tar
path: tar_intel
- name: calulate sha of tar intel
run: |
first_tar_gz=$(ls tar_intel/*.tar.gz | head -n 1)
if [ -z "$first_tar_gz" ]; then
echo "No .tar.gz file found in artifacts directory"
exit 1
fi
checksum=$(shasum -a 256 "$first_tar_gz" | awk '{print $1}')
echo "checksum_intel=$checksum" >> $GITHUB_ENV
- name: calulate sha of tar arm
run: |
first_tar_gz=$(ls tar_arm/*.tar.gz | head -n 1)
if [ -z "$first_tar_gz" ]; then
echo "No .tar.gz file found in artifacts directory"
exit 1
fi
checksum=$(shasum -a 256 "$first_tar_gz" | awk '{print $1}')
echo "checksum_arm=$checksum" >> $GITHUB_ENV
- name: get version of app
run: |
nix build .#get_termusix_version_darwin
version=$(cat result/version.txt)
echo "version_termusix=$version" >> $GITHUB_ENV
- name: build the ruby file
run: |
shaArm=${{ env.checksum_arm }}
shaIntel=${{ env.checksum_intel }}
version=${{ env.version_termusix }}
echo "checksum_arm=$shaArm"
echo "checksum_intel=$shaIntel"
echo "version=$version"
nix develop --command ./scripts/pack_homebrew.sh $shaArm $shaIntel $version
cat rb_build/termusix.rb
- name: upload ruby file
uses: actions/upload-artifact@v4
with:
name: homebrew-pack-termusix
path: rb_build/termusix.rb
test-from-latest-ubuntu:
name : test for linux_x86_64
runs-on: ubuntu-latest
needs: build-for-linux_x86_64
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-x86_64-linux
- name: set permissions on package
run: chmod +x termusix-x86_64-linux
- name: Ensure the command runs
run: ./termusix-x86_64-linux --version
test-from-apple-arm:
name : test for apple ARM
runs-on: macos-latest
needs: build-for-apple-arm
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-aarch64-apple
- name: set permissions on package
run: chmod +x termusix-aarch64-apple
- name: Ensure the command runs
run: ./termusix-aarch64-apple --version
test-from-apple-x86_64:
name : test for x86_64-apple-darwin
runs-on: macos-13
needs: build-for-apple-intel
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-x86_64-apple
- name: set permissions on package
run: chmod +x termusix-x86_64-apple
- name: Ensure the command runs
run: ./termusix-x86_64-apple --version
test-from-windows:
name : test for windows
runs-on: windows-latest
needs: build-for-arm-linux-and-windows
steps:
- uses: actions/download-artifact@v4
with:
name: termusix-x86_64-windows
- name: Ensure the command runs
run: ./termusix-x86_64-windows.exe --version
make-release-group:
runs-on: ubuntu-latest
needs:
- test-from-latest-ubuntu
- test-from-apple-arm
- test-from-apple-x86_64
- test-from-windows
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release
pattern: termusix-*
merge-multiple: true
- name : List all packages
run : ls -R
- uses: actions/upload-artifact@v4
with:
name: release
path: release