-
Notifications
You must be signed in to change notification settings - Fork 89
253 lines (244 loc) · 7.47 KB
/
CI.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
name: CI
on:
push:
paths-ignore:
- '*.md'
- '*.yml'
pull_request:
paths-ignore:
- '*.md'
- '*.yml'
jobs:
Init:
runs-on: ubuntu-latest
steps:
- name: Create build tag
run: |
export BUILD_TAG=build-$(date -u +'%Y%m%d%H%M')
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_ENV
echo -n $BUILD_TAG > tag
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: tag
path: tag
build-windows:
runs-on: windows-latest
needs: Init
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
strategy:
fail-fast: false
matrix:
configuration: [Release, Debug]
arch: [x86, x64]
include:
- arch: x86
platform: Win32
artifact_os: Win32
- arch: x64
platform: x64
artifact_os: Win64
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: CMake generate
run: |
mkdir build && cd build
cmake .. -A ${{ matrix.platform }}
- name: Build
working-directory: build
run: cmake --build . --config ${{ matrix.configuration }} -j $env:NUMBER_OF_PROCESSORS
- name: Copy licenses
run: |
mkdir LICENSES
for /D %%x in (deps/*) do (
mkdir LICENSES\%%x
copy deps\%%x\LICENSE* LICENSES\%%x
)
shell: cmd
- name: Prepare artifacts
run: |
mkdir artifacts
mv -vb build\${{ matrix.configuration }}\extract-xiso.exe, LICENSE.TXT, LICENSES artifacts
- uses: actions/upload-artifact@v4
with:
name: extract-xiso-${{ matrix.artifact_os }}-${{ matrix.configuration }}
path: artifacts
build-linux:
runs-on: ubuntu-latest
needs: Init
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: CMake generate
run: |
mkdir build && cd build
cmake ..
- name: Build
working-directory: build
run: cmake --build . -j $(nproc --all)
- name: Prepare artifacts
run: |
mkdir artifacts
mv -v build/extract-xiso LICENSE.TXT artifacts
- uses: actions/upload-artifact@v4
with:
name: extract-xiso-linux
path: artifacts
build-macos:
runs-on: macos-latest
needs: Init
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: CMake generate
run: |
mkdir build && cd build
cmake ..
- name: Build
working-directory: build
run: cmake --build . -j $(sysctl -n hw.ncpu)
- name: Prepare artifacts
run: |
mkdir artifacts
mv -v build/extract-xiso LICENSE.TXT artifacts
- uses: actions/upload-artifact@v4
with:
name: extract-xiso-macos
path: artifacts
build-freebsd:
runs-on: ubuntu-latest
needs: Init
env:
SYSROOT_PATH: /opt/cross-freebsd-13
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: FreeBSD toolchain setup
run: |
sudo apt-get -qq install clang lld && cd /tmp && \
wget -nv http://ftp.plusline.de/FreeBSD/releases/amd64/13.2-RELEASE/base.txz && \
mkdir -p $SYSROOT_PATH && cd $SYSROOT_PATH && \
tar -xf /tmp/base.txz ./lib/ ./usr/lib/ ./usr/include/ && \
cd $SYSROOT_PATH/usr/lib && \
find . -xtype l | xargs ls -l | grep ' /lib/' | awk -v sysroot="$SYSROOT_PATH" '{print "ln -sf " sysroot $11 " " $9}' | /bin/sh && \
rm -f /tmp/base.txz
- name: CMake generate
run: |
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../.github/data/BSD.cmake -DCMAKE_SYSTEM_NAME=FreeBSD -DTARGET=x86_64-pc-freebsd -DSYSROOT_PATH=$SYSROOT_PATH ..
- name: Build
working-directory: build
run: cmake --build . -j $(nproc --all)
- name: Prepare artifacts
run: |
mkdir artifacts
mv -v build/extract-xiso LICENSE.TXT artifacts
- uses: actions/upload-artifact@v4
with:
name: extract-xiso-freebsd
path: artifacts
build-openbsd:
runs-on: ubuntu-latest
needs: Init
env:
SYSROOT_PATH: /opt/cross-openbsd-7
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: OpenBSD toolchain setup
run: |
sudo apt-get -qq install clang lld && cd /tmp && \
wget -nv https://cdn.openbsd.org/pub/OpenBSD/7.4/amd64/base74.tgz \
https://cdn.openbsd.org/pub/OpenBSD/7.4/amd64/comp74.tgz && \
mkdir -p $SYSROOT_PATH && cd $SYSROOT_PATH && \
tar -xf /tmp/base74.tgz ./usr/lib/ ./usr/include/ && \
tar -xf /tmp/comp74.tgz ./usr/lib/ ./usr/include/ && \
rm -f /tmp/base74.tgz /tmp/comp74.tgz
- name: CMake generate
run: |
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../.github/data/BSD.cmake -DCMAKE_SYSTEM_NAME=OpenBSD -DTARGET=x86_64-pc-openbsd -DSYSROOT_PATH=$SYSROOT_PATH ..
- name: Build
working-directory: build
run: cmake --build . -j $(nproc --all)
- name: Prepare artifacts
run: |
mkdir artifacts
mv -v build/extract-xiso LICENSE.TXT artifacts
- uses: actions/upload-artifact@v4
with:
name: extract-xiso-openbsd
path: artifacts
build-netbsd:
runs-on: ubuntu-latest
needs: Init
env:
SYSROOT_PATH: /opt/cross-netbsd-9
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: NetBSD toolchain setup
run: |
sudo apt-get -qq install clang lld && cd /tmp && \
wget -nv https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/amd64/binary/sets/base.tar.xz \
https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.3/amd64/binary/sets/comp.tar.xz && \
mkdir -p $SYSROOT_PATH && cd $SYSROOT_PATH && \
tar -xf /tmp/base.tar.xz ./usr/lib/ ./usr/include/ && \
tar -xf /tmp/comp.tar.xz ./usr/lib/ ./usr/include/ && \
rm -f /tmp/base.tar.xz /tmp/comp.tar.xz
- name: CMake generate
run: |
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../.github/data/BSD.cmake -DCMAKE_SYSTEM_NAME=NetBSD -DTARGET=x86_64-pc-netbsd -DSYSROOT_PATH=$SYSROOT_PATH ..
- name: Build
working-directory: build
run: cmake --build . -j $(nproc --all)
- name: Prepare artifacts
run: |
mkdir artifacts
mv -v build/extract-xiso LICENSE.TXT artifacts
- uses: actions/upload-artifact@v4
with:
name: extract-xiso-netbsd
path: artifacts
Release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [build-windows, build-linux, build-macos, build-freebsd, build-openbsd, build-netbsd]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Create archives
run: |
for dir in dist/extract-xiso-*/
do
pushd ${dir}
zip_file="../$(basename ${dir} | tr '[:upper:]' '[:lower:]').zip"
echo "Create ${zip_file}"
zip -r ${zip_file} *
popd
done
- name: Get package info
run: |
echo "BUILD_TAG=$(cat dist/tag/tag)" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.BUILD_TAG }}
draft: false
prerelease: false
fail_on_unmatched_files: true
files: dist/*.zip