-
Notifications
You must be signed in to change notification settings - Fork 74
181 lines (150 loc) · 5.22 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
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 }}
build-darwin:
name: Build MacOS executable
runs-on: macos-latest
steps:
- name: Install Conan
run: pip3 install conan==1.53.0
- uses: actions/checkout@v3
- name: Install conan dependencies
run: conan install --build=libpng --build=zlib .
- name: Build the app
run: cmake CMakeLists.txt && make
- name: Upload 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/lottie-to-png.darwin.amd64
- name: Rename the executable
run: mv bin/lottie-to-png.darwin.amd64 bin/lottie_to_png && chmod +x bin/lottie_to_png
- name: Run tests
run: |
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 \${WIDTH:+--width \$WIDTH} \${HEIGHT:+--height \$HEIGHT} \${FPS:+--fps \$FPS} \${QUALITY:+--quality \$QUALITY} \$FILE && echo Done.; \
done
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