-
Notifications
You must be signed in to change notification settings - Fork 74
233 lines (191 loc) · 6.51 KB
/
ci-build-and-test.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
name: CI | Build & Test
on:
push:
pull_request:
jobs:
build-docker:
name: Build docker images
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
- arm64
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker caching
uses: jpribyl/[email protected]
continue-on-error: true
- name: Build lottie-to-apng
run: docker build -t lottie-to-apng:${{ matrix.platform }} --target lottie-to-apng --platform ${{ matrix.platform }} .
- name: Upload lottie-to-apng as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-apng:${{ matrix.platform }}
- name: Build lottie-to-gif
run: docker build -t lottie-to-gif:${{ matrix.platform }} --target lottie-to-gif --platform ${{ matrix.platform }} .
- name: Upload lottie-to-gif as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-gif:${{ matrix.platform }}
- name: Build lottie-to-png
run: docker build -t lottie-to-png:${{ matrix.platform }} --target lottie-to-png --platform ${{ matrix.platform }} .
- name: Upload lottie-to-png as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-png:${{ matrix.platform }}
- name: Build lottie-to-webp
run: docker build -t lottie-to-webp:${{ matrix.platform }} --target lottie-to-webp --platform ${{ matrix.platform }} .
- name: Upload lottie-to-webp as artifact
uses: ishworkh/[email protected]
with:
image: lottie-to-webp:${{ matrix.platform }}
test-docker:
name: Run tests
needs: build-docker
runs-on: ubuntu-latest
strategy:
matrix:
image:
- apng
- gif
- png
- webp
platform:
- amd64
- arm64
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Download ${{ matrix.image }} image as artefact
uses: ishworkh/[email protected]
with:
image: lottie-to-${{ matrix.image }}:${{ matrix.platform }}
- uses: actions/checkout@v3
- name: Run tests
run: docker run --rm -v $(pwd)/test-files:/source --platform ${{ matrix.platform }} lottie-to-${{ matrix.image }}:${{ matrix.platform }}
- name: Upload test results as artifacts
uses: actions/upload-artifact@v3
with:
name: test-results.linux.${{ matrix.platform }}.${{ matrix.image }}
path: test-files
build-darwin:
name: Build MacOS executable
runs-on: macos-latest
steps:
- name: Install Conan
run: pip3 install conan==2.0.10
- uses: actions/checkout@v3
- name: Detect conan profile
run: conan profile detect
- name: Install conan dependencies
run: conan install . --build=missing
- name: Invoke 'conan-release' preset
run: cmake --preset conan-release
- name: Build the app
run: cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt && cmake --build .
- name: Upload executable as artifact
uses: actions/upload-artifact@v3
with:
name: lottie-to-png.darwin.amd64
path: bin/lottie_to_png
test-darwin:
name: Test MacOS
needs: build-darwin
runs-on: macos-latest
strategy:
matrix:
case:
- apng
- gif
- png
- webp
steps:
- uses: actions/checkout@v3
- name: Install run-time dependencies
run: |
[[ "${{ matrix.case }}" == "apng" ]] && brew install ffmpeg || echo ok;
[[ "${{ matrix.case }}" == "gif" ]] && brew install gifski || echo ok;
[[ "${{ matrix.case }}" == "webp" ]] && brew install webp || echo ok;
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: lottie-to-png.darwin.amd64
path: bin
- name: Run tests
run: |
chmod +x bin/lottie_to_png && \
bash -c "\
find test-files -type f \( -iname \*.json -o -iname \*.lottie -o -iname \*.tgs \) | while IFS=$'\n' read -r FILE; do \
echo Converting \${FILE}... && ./bin/lottie_to_${{ matrix.case }}.sh \$FILE && echo Done.; \
done \
"
- name: Upload test results as artifacts
uses: actions/upload-artifact@v3
with:
name: test-results.darwin.amd64.${{ matrix.case }}
path: test-files
build-windows:
name: Build Windows executable
runs-on: windows-latest
steps:
- name: Install Conan
run: pip3 install conan==2.0.10
- uses: actions/checkout@v3
- name: Detect conan profile
run: conan profile detect
- name: Install conan dependencies
run: conan install . --build=missing
- name: Invoke 'conan-default' preset
run: cmake --preset conan-default
- name: Build the app
run: cmake -DCMAKE_BUILD_TYPE=Release CMakeLists.txt && cmake --build .
continue-on-error: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: lottie-to-png.win.amd64
path: .
- name: Upload test results as artifacts
uses: actions/upload-artifact@v3
with:
name: test-results.windows.amd64.${{ matrix.case }}
path: test-files
release:
needs:
- test-docker
- test-darwin
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- amd64
- arm64
steps:
- name: Download image as artefact
uses: ishworkh/[email protected]
with:
image: lottie-to-png:${{ matrix.platform }}
- uses: actions/checkout@v3
- name: Extract
run: |
id=$(docker create lottie-to-png:${{ matrix.platform }}) &&
docker cp $id:/usr/bin/lottie_to_png bin/ &&
docker rm -v $id
- name: Archive Release
uses: thedoctor0/[email protected]
with:
type: 'zip'
path: bin
filename: release-${{ matrix.platform }}.zip
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: release-${{ matrix.platform }}.zip
name: ${{ github.ref }}
allowUpdates: true
draft: true