-
Notifications
You must be signed in to change notification settings - Fork 5
318 lines (300 loc) Β· 11.1 KB
/
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
name: Build
on: [push, pull_request]
concurrency:
group: ci-${{ github.head_ref || github.ref }}-${{ github.repository }}
cancel-in-progress: true
jobs:
generate-matrix:
name: Generate matrix for build
runs-on: ubuntu-latest
env:
LUET_VERSION: 0.18.1
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- name: Install deps
run: |
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
sudo luet install -y repository/mocaccino-extra
sudo luet install -y utils/jq
- name: Set matrix for build
id: set-matrix
run: |
JSON="{\"include\":"
JSONline="$(luet tree pkglist --tree packages -o json | jq -rc '.packages')"
JSON="$JSON$JSONline"
JSON="$JSON}"
# Set output
echo "::set-output name=matrix::$( echo "$JSON" )"
build:
needs: generate-matrix
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
env:
LUET_VERSION: 0.18.1
ARCH: amd64
# CONFIGURE: FINAL_REPO is the container image which will be used
# to push packages to.
#FINAL_REPO: quay.io/mocaccino/mocaccino-community
FINAL_REPO: quay.io/mocaccino/extra
CURRENT_PACKAGE: ${{ matrix.category }}/${{ matrix.name }}@${{ matrix.version }}
# Repository used to pull images from. needed if you list any repo in .luet.yaml
#PULL_REPOSITORY: quay.io/mocaccinocache/desktop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Release space from worker
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- run: |
git fetch --prune --unshallow
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# CONFIGURE: we might use quay here in our example, adapt as needed
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io
# - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Install deps π§
run: |
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
docker buildx
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.16'
- if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
name: "Push cache"
run: echo "PUSH_CACHE=true" >> $GITHUB_ENV
- if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
name: "Enable Buildx"
run: echo "BUILDX=true" >> $GITHUB_ENV
- name: Build packages π§
run: |
docker buildx install
export PATH=$PATH:/usr/local/go/bin
mkdir build || true
pushd ./.github
go build -o build
popd
sudo -E ./.github/build
ls -liah $PWD/build
sudo chmod -R 777 $PWD/build
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.category }}-${{ matrix.name }}-${{ matrix.version }}.zip
path: |
build/
create-repo:
needs: build
env:
LUET_VERSION: 0.18.1
FINAL_REPO: quay.io/mocaccino/extra
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io
# - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Install deps π§
run: |
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.16'
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Merge artifacts π§
run: |
mkdir build || true
for i in $(ls | grep zip); do
cp -rfv $i/* build
done
ls -liah
ls -liah build
- name: Fetch metadata of packages π§
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
ls -liah
export PATH=$PATH:/usr/local/go/bin
pushd ./.github
go build -o build
popd
sudo -E ./.github/build
ls -liah $PWD/build
sudo chmod -R 777 $PWD/build
- name: Create repo π§
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
FINAL_REPO=$(echo "$FINAL_REPO" | tr '[:upper:]' '[:lower:]')
sudo -E luet create-repo \
--push-images \
--type docker \
--output $FINAL_REPO \
--name "mocaccino-extra" \
--packages ${PWD}/build \
--tree ${PWD}/packages
# - name: Deploy GH Pages π
# if: github.ref == 'refs/heads/master' && github.event_name == 'push'
# uses: JamesIves/[email protected]
# with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BRANCH: gh-pages # The branch the action should deploy to.
# FOLDER: build # The folder the action should deploy.
# CLEAN: true # Automatically remove deleted files from the deploy branch
# SINGLE_COMMIT: true
build-arm:
needs: [ generate-matrix, create-repo ]
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
env:
LUET_VERSION: 0.18.1
ARCH: arm/v7
# CONFIGURE: FINAL_REPO is the container image which will be used
# to push packages to.
#FINAL_REPO: quay.io/mocaccino/mocaccino-community
FINAL_REPO: quay.io/mocaccino/extra-arm
CURRENT_PACKAGE: ${{ matrix.category }}/${{ matrix.name }}@${{ matrix.version }}
# Repository used to pull images from. needed if you list any repo in .luet.yaml
#PULL_REPOSITORY: quay.io/mocaccinocache/desktop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Release space from worker
run: |
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
- run: |
git fetch --prune --unshallow
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# CONFIGURE: we might use quay here in our example, adapt as needed
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io
# - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Install deps π§
run: |
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.16'
- if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
name: "Push cache"
run: echo "PUSH_CACHE=true" >> $GITHUB_ENV
- if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
name: "Enable Buildx"
run: echo "BUILDX=true" >> $GITHUB_ENV
- name: Build packages π§
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
docker buildx install
export PATH=$PATH:/usr/local/go/bin
mkdir build || true
pushd ./.github
go build -o build
popd
sudo -E ./.github/build
ls -liah $PWD/build
sudo chmod -R 777 $PWD/build
- uses: actions/upload-artifact@v2
with:
name: arm-${{ matrix.category }}-${{ matrix.name }}-${{ matrix.version }}.zip
path: |
build/
create-repo-arm:
needs: build-arm
env:
LUET_VERSION: 0.18.1
FINAL_REPO: quay.io/mocaccino/extra-arm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow
- name: Login to Quay Registry
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io
# - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
# name: Login to GitHub Container Registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Install deps π§
run: |
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.16'
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Merge artifacts π§
run: |
mkdir build || true
for i in $(ls | grep zip | grep arm); do
cp -rfv $i/* build
done
ls -liah
ls -liah build
- name: Fetch metadata of packages π§
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
ls -liah
export PATH=$PATH:/usr/local/go/bin
pushd ./.github
go build -o build
popd
sudo -E ./.github/build
ls -liah $PWD/build
sudo chmod -R 777 $PWD/build
- name: Create repo π§
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
FINAL_REPO=$(echo "$FINAL_REPO" | tr '[:upper:]' '[:lower:]')
sudo -E luet create-repo \
--push-images \
--type docker \
--output $FINAL_REPO \
--name "mocaccino-extra" \
--packages ${PWD}/build \
--tree ${PWD}/packages