-
Notifications
You must be signed in to change notification settings - Fork 4
214 lines (182 loc) · 5.82 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
name: build
on:
push:
branches: '*'
tags: 'v*.*'
pull_request:
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { name: linux-x64, image: debian, platform: linux/amd64 }
- { name: linux-arm, image: debian, platform: linux/arm/v7 }
- { name: linux-arm64, image: debian, platform: linux/arm64 }
- { name: linux-arm-musl, image: alpine, platform: linux/arm/v7 }
- { name: linux-arm64-musl, image: alpine, platform: linux/arm64 }
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Prepare builder image
uses: docker/build-push-action@v3
with:
platforms: ${{ matrix.platform }}
file: .github/Dockerfile.${{ matrix.image }}
context: .github
tags: cskburn-${{ matrix.name }}:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build
uses: tj-actions/docker-run@v2
with:
image: cskburn-${{ matrix.name }}:latest
name: ${{ matrix.name }}
options: >-
--platform ${{ matrix.platform }}
--volume ${{ github.workspace }}:/cskburn
--workdir /cskburn
args: |
bash -c '
git config --global --add safe.directory $PWD
cmake -G Ninja -B build
cmake --build build --config Release
'
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: cskburn-${{ matrix.name }}
path: build/cskburn/cskburn
if-no-files-found: error
- name: Upload release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ./.github/actions/release-tar-xz
with:
name: cskburn-${{ matrix.name }}.tar.xz
root-dir: build/cskburn
files: cskburn
tag: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
build-darwin:
runs-on: macos-latest
strategy:
matrix:
include:
- { name: darwin-x64, arch: x86_64 }
- { name: darwin-arm64, arch: arm64 }
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
- name: Build
uses: ./.github/actions/cmake-build
env:
CMAKE_OSX_ARCHITECTURES: ${{ matrix.arch }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: cskburn-${{ matrix.name }}
path: build/cskburn/cskburn
if-no-files-found: error
- name: Upload release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ./.github/actions/release-tar-xz
with:
name: cskburn-${{ matrix.name }}.tar.xz
root-dir: build/cskburn
files: cskburn
tag: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
build-win32:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- { name: win32-x64, os: windows-latest }
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Setup MinGW-w64
id: setup-mingw64
uses: ./.github/actions/setup-mingw64
with:
install: >-
git
zip
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
- name: Build
uses: ./.github/actions/cmake-build
with:
run-tests: true
shell: ${{ steps.setup-mingw64.outputs.shell }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: cskburn-${{ matrix.name }}
path: build/cskburn/cskburn.exe
if-no-files-found: error
- name: Upload release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ./.github/actions/release-zip
with:
shell: ${{ steps.setup-mingw64.outputs.shell }}
name: cskburn-${{ matrix.name }}.zip
root-dir: build/cskburn
files: cskburn.exe
tag: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
build-android:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { name: android-armeabi-v7a, abi: armeabi-v7a }
- { name: android-arm64-v8a, abi: arm64-v8a }
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
- name: Setup NDK
id: setup-ndk
uses: nttld/setup-ndk@v1
with:
ndk-version: r21e
- name: Build
uses: ./.github/actions/cmake-build
with:
build-args: >-
-DCMAKE_SYSTEM_NAME=Android
-DCMAKE_ANDROID_ARCH_ABI=${{ matrix.abi }}
-DCMAKE_ANDROID_NDK=${{ steps.setup-ndk.outputs.ndk-path }}
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: cskburn-android-${{ matrix.abi }}
path: build/cskburn/cskburn
if-no-files-found: error
- name: Upload release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
uses: ./.github/actions/release-tar-xz
with:
name: cskburn-${{ matrix.name }}.tar.xz
root-dir: build/cskburn
files: cskburn
tag: ${{ github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}