-
-
Notifications
You must be signed in to change notification settings - Fork 0
309 lines (293 loc) · 9.27 KB
/
Copy pathbuild.yml
File metadata and controls
309 lines (293 loc) · 9.27 KB
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
name: build
on: [push, pull_request]
jobs:
build_source:
name: Create source tarball
runs-on: ubuntu-latest
container:
image: opensuse/tumbleweed
steps:
- name: Update packages
run: zypper -n --gpg-auto-import-keys ref
- name: Upgrade packages
run: zypper -n --gpg-auto-import-keys dup
- name: Install openSUSE dependencies
run: >
zypper -n --gpg-auto-import-keys in
lsb-release
rpm-build
git
tar
make
cmake
gcc
gcc-c++
gettext-tools
glibc-devel
libboost_headers-devel
file-devel
zlib-devel
glib2-devel
glib2-tools
libicu-devel
unixODBC-devel
qt6-core-devel
qt6-gui-devel
qt6-widgets-devel
qt6-concurrent-devel
qt6-network-devel
qt6-sql-devel
qt6-test-devel
qt6-base-common-devel
qt6-sql-unixODBC
qt6-linguist-devel
quazip-qt6-devel
desktop-file-utils
update-desktop-files
appstream-glib
hicolor-icon-theme
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add safe git directory
shell: bash
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Create Build Environment
shell: bash
run: cmake -E make_directory build
- name: Configure CMake
shell: bash
working-directory: build
run: cmake .. -DCMAKE_BUILD_TYPE="Debug" -DBUILD_WITH_QT6=ON
- name: Create source tarball
working-directory: build
run: ../dist/scripts/maketarball.sh
- uses: actions/upload-artifact@v3
with:
name: release_source
path: build/*.xz
build_opensuse_tumbleweed:
name: Build openSUSE Tumbleweed
runs-on: ubuntu-latest
container:
image: opensuse/tumbleweed
steps:
- name: Update packages
run: zypper -n --gpg-auto-import-keys ref
- name: Upgrade packages
run: zypper -n --gpg-auto-import-keys dup
- name: Install openSUSE dependencies
run: >
zypper -n --gpg-auto-import-keys in
lsb-release
rpm-build
git
tar
make
cmake
gcc
gcc-c++
gettext-tools
glibc-devel
libboost_headers-devel
file-devel
zlib-devel
glib2-devel
glib2-tools
libicu-devel
unixODBC-devel
qt6-core-devel
qt6-gui-devel
qt6-widgets-devel
qt6-concurrent-devel
qt6-network-devel
qt6-sql-devel
qt6-test-devel
qt6-base-common-devel
qt6-sql-unixODBC
qt6-linguist-devel
quazip-qt6-devel
desktop-file-utils
update-desktop-files
appstream-glib
hicolor-icon-theme
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add safe git directory
shell: bash
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Create Build Environment
shell: bash
run: cmake -E make_directory build
- name: Configure CMake
shell: bash
working-directory: build
run: cmake .. -DCMAKE_BUILD_TYPE="Debug" -DBUILD_WITH_QT6=ON
- name: Create source tarball
working-directory: build
run: ../dist/scripts/maketarball.sh
- name: Create RPM build sources directories
run: mkdir -p ~/rpmbuild/SOURCES /usr/src/packages/SOURCES
- name: Copy source tarball
working-directory: build
run: cp sqlrestore-*.tar.xz /usr/src/packages/SOURCES/
- name: Build RPM
working-directory: build
run: rpmbuild -ba ../dist/unix/sqlrestore.spec
build_fedora_36:
name: Build Fedora 36
runs-on: ubuntu-latest
container:
image: fedora:36
env:
RPM_BUILD_NCPUS: "2"
steps:
- name: Update packages
run: yum update --assumeyes
- name: Upgrade packages
run: yum upgrade --assumeyes
- name: Install Fedora dependencies
run: >
dnf install -y
@development-tools
redhat-lsb-core
git
glibc
gcc-c++
rpmdevtools
make
cmake
pkgconfig
man
tar
gettext
openssh
boost-devel
file-devel
glib2-devel
libicu-devel
unixODBC-devel
qt6-qtbase-devel
qt6-qttools-devel
quazip-qt6-devel
desktop-file-utils
libappstream-glib
hicolor-icon-theme
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add safe git directory
shell: bash
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Create Build Environment
shell: bash
run: cmake -E make_directory build
- name: Configure CMake
shell: bash
working-directory: build
run: cmake .. -DCMAKE_BUILD_TYPE="Debug" -DBUILD_WITH_QT6=ON
- name: Create source tarball
working-directory: build
run: ../dist/scripts/maketarball.sh
- name: Create RPM build sources directories
working-directory: build
run: mkdir -p ~/rpmbuild/SOURCES /usr/src/packages/SOURCES
- name: Copy source tarball
working-directory: build
run: cp sqlrestore-*.tar.xz ~/rpmbuild/SOURCES/
- name: Build RPM
working-directory: build
run: rpmbuild -ba ../dist/unix/sqlrestore.spec
- uses: actions/upload-artifact@v3
with:
name: release_fedora_36
path: ~/rpmbuild/RPMS/*/*.rpm
build_windows:
name: Build Windows
runs-on: ubuntu-latest
container:
image: jonaski/mxe-qt-x86_64-w64-mingw32.static
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Add safe git directory
shell: bash
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Create Build Environment
shell: bash
run: cmake -E make_directory build
- name: Link MXE directory
shell: bash
run: ln -s /usr/src/mxe-qt ~/mxe-static
- name: Run CMake
shell: bash
env:
PKG_CONFIG_PATH: /usr/src/mxe-qt/usr/x86_64-w64-mingw32.static/lib/pkgconfig
working-directory: build
run: >
/usr/src/mxe-qt/usr/bin/x86_64-w64-mingw32.static-cmake
..
-DCMAKE_BUILD_TYPE="Release"
-DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-mingw32-static.cmake"
-DCMAKE_PREFIX_PATH="/usr/src/mxe-qt/usr/x86_64-w64-mingw32.static/qt6/lib/cmake"
-DBUILD_WITH_QT6=ON
-DENABLE_WIN32_CONSOLE=OFF
- name: Run Make
working-directory: build
run: make -j2
- name: Strip executables
working-directory: build
run: /usr/src/mxe-qt/usr/bin/x86_64-w64-mingw32.static-strip *.exe
- uses: actions/upload-artifact@v3
with:
name: release-windows
path: build/*.exe
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
needs:
- build_source
- build_fedora_36
- build_windows
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set is_pre_release
run: echo "is_pre_release=$(grep 'set(INCLUDE_GIT_REVISION ON)' cmake/Version.cmake >/dev/null 2>&1 && echo 1 || echo 0)" >> $GITHUB_ENV
- name: Set version
if: env.is_pre_release == '1'
run: echo "version=$(git describe --long --tags --always --exclude pre-release)" >> $GITHUB_ENV
- name: Have have_pre_release
if: env.is_pre_release == '1'
run: echo "have_pre_release=$(git tag -l | grep pre-release >/dev/null 2>&1 && echo 1 || echo 0)" >> $GITHUB_ENV
- name: Delete previous pre-release
if: env.is_pre_release == '1' && env.have_pre_release == '1' && env.version != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
hub release delete "pre-release"
git tag -d "pre-release"
git push --delete origin "pre-release"
- name: Download artifacts
if: env.is_pre_release == '1' && env.version != ''
uses: actions/download-artifact@v3
with:
path: releases
- name: Create Release
if: env.is_pre_release == '1' && env.version != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
echo "Version: ${{env.version}}"
files=()
for file in $(find releases -type f); do
echo "Adding file: ${file}"
files+=("-a" "${file}")
done
hub release create -p -t "$GITHUB_SHA" -m "SQL Restore ${{env.version}}" "${files[@]}" "pre-release"