-
Notifications
You must be signed in to change notification settings - Fork 5
333 lines (302 loc) · 14.4 KB
/
software.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
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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# ------------------------------------------------------------------------------
# USB EPROM/Flash Programmer
#
# Copyright (2022) Robson Martins
#
# This work is licensed under a Creative Commons Attribution-NonCommercial-
# ShareAlike 4.0 International License.
# ------------------------------------------------------------------------------
name: Build Software
on:
workflow_dispatch:
env:
BUILD_TYPE: Release
SOFTWARE_PROJECT_DIR: ${{github.workspace}}/software/usbflashprog
jobs:
build_software:
name: Build Software (Linux, Windows, MacOS)
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
arch: [x86_64, x86]
runs-on: ${{matrix.os}}
continue-on-error: true
steps:
# ------------------------------------------------------------------------
# Checkout the sources
# ------------------------------------------------------------------------
- name: Checkout the Sources
uses: actions/checkout@v3
# ------------------------------------------------------------------------
# Install MinGW (Windows)
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86_64'
name: Install MinGW64 (Windows 64-bits)
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
install:
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
release: false
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86'
name: Install MinGW32 (Windows 32-bits)
uses: msys2/setup-msys2@v2
with:
msystem: mingw32
install:
mingw-w64-i686-toolchain
mingw-w64-i686-cmake
release: false
# ------------------------------------------------------------------------
# Install Inno Setup (Windows)
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest'
name: Install Inno Setup (Windows)
env:
INNO_SETUP_DOWNLOAD_URL: "https://files.jrsoftware.org/is/6/innosetup-6.2.1.exe"
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}/scripts
run: |
wget "${{env.INNO_SETUP_DOWNLOAD_URL}}"
./innosetup-6.2.1.exe //VERYSILENT //SUPPRESSMSGBOXES //SP //CURRENTUSER //LANG=en //NORESTART //NOICONS //DIR=".\is"
shell: msys2 {0}
# ------------------------------------------------------------------------
# Install Qt (Windows/MacOS)
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86_64'
name: Cache Qt (Windows 64-bits)
id: cache-qt-win64
uses: actions/cache@v3
with:
path: ../QtCacheWin64
key: ${{ runner.os }}-QtCacheWin64
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86_64'
name: Install Qt (Windows 64-bits)
uses: jurplel/install-qt-action@v3
with:
cache: 'true'
cache-key-prefix: ${{ steps.cache-qt-win64.outputs.cache-hit }}
version: '5.15.2'
host: 'windows'
target: 'desktop'
arch: 'win64_mingw81'
dir: '${{env.SOFTWARE_PROJECT_DIR}}/qt/'
install-deps: 'true'
extra: '--timeout 30'
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86'
name: Cache Qt (Windows 32-bits)
id: cache-qt-win32
uses: actions/cache@v3
with:
path: ../QtCacheWin32
key: ${{ runner.os }}-QtCacheWin32
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86'
name: Install Qt (Windows 32-bits)
uses: jurplel/install-qt-action@v3
with:
cache: 'true'
cache-key-prefix: ${{ steps.cache-qt-win32.outputs.cache-hit }}
version: '5.15.2'
host: 'windows'
target: 'desktop'
arch: 'win32_mingw81'
dir: '${{env.SOFTWARE_PROJECT_DIR}}/qt/'
install-deps: 'true'
extra: '--timeout 30'
# ------------------------------------------------------------------------
- if: matrix.os == 'macos-latest' && matrix.arch == 'x86_64'
name: Install Qt (MacOS)
run: |
brew install qt5
echo "Qt5_Dir=$(brew --prefix qt5)/lib/cmake/Qt5" >> $GITHUB_ENV
# ------------------------------------------------------------------------
# Install Prerequisites (Linux)
# ------------------------------------------------------------------------
- if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64'
name: Install Prerequisites (Linux 64-bits)
run: |
sudo apt-get update
sudo apt-get install cmake build-essential libglu1-mesa-dev libpulse-dev libglib2.0-dev rpm sed
sudo apt-get --no-install-recommends install libqt*5-dev qt*5-dev libqt5waylandcompositor5-dev
# ------------------------------------------------------------------------
# Configure CMake
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest'
name: Configure CMake (Windows)
env:
CMAKE_PREFIX_PATH: ${{env.Qt5_Dir}}
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: cmake -G "MinGW Makefiles" -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
shell: msys2 {0}
- if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64'
name: Configure CMake (Linux)
env:
CMAKE_PREFIX_PATH: ${{env.Qt5_Dir}}
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- if: matrix.os == 'macos-latest' && matrix.arch == 'x86_64'
name: Configure CMake (MacOS)
env:
CMAKE_PREFIX_PATH: ${{env.Qt5_Dir}}
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: cmake -G Xcode -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
# ------------------------------------------------------------------------
# Build
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest'
name: Build (Windows)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: |
cmake --build build --config ${{env.BUILD_TYPE}}
echo "BUILD_VERSION=`cat VERSION`" >> $GITHUB_ENV
echo "BUILD_REVISION=`date +%y%m%d`" >> $GITHUB_ENV
shell: msys2 {0}
- if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64'
name: Build (Linux)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: |
cmake --build build --config ${{env.BUILD_TYPE}}
echo "BUILD_VERSION=`cat VERSION`" >> $GITHUB_ENV
echo "BUILD_REVISION=`date +%y%m%d`" >> $GITHUB_ENV
- if: matrix.os == 'macos-latest' && matrix.arch == 'x86_64'
name: Build (MacOS)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: |
echo "BUILD_VERSION=`cat VERSION`" >> $GITHUB_ENV
echo "BUILD_REVISION=`date +%y%m%d`" >> $GITHUB_ENV
rm VERSION
cmake --build build --config ${{env.BUILD_TYPE}}
# ------------------------------------------------------------------------
# Create the Installer
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86_64'
name: Create the Installer (Windows 64-bits)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}/scripts
run: |
./is/iscc.exe //DARCH="Win64" //DQT_PATH="..\\qt\\Qt\\5.15.2\\mingw81_64" //Dversion="`cat ../VERSION`" ufprog.iss
mv "../build/ufprog-`cat ../VERSION`-0-win64-setup.exe" "../build/ufprog-${{env.BUILD_VERSION}}-${{env.BUILD_REVISION}}-win64-setup.exe"
shell: msys2 {0}
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86'
name: Create the Installer (Windows 32-bits)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}/scripts
run: |
./is/iscc.exe //DARCH="Win32" //DQT_PATH="..\\qt\\Qt\\5.15.2\\mingw81_32" //Dversion="`cat ../VERSION`" ufprog.iss
mv "../build/ufprog-`cat ../VERSION`-0-win32-setup.exe" "../build/ufprog-${{env.BUILD_VERSION}}-${{env.BUILD_REVISION}}-win32-setup.exe"
shell: msys2 {0}
- if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64'
name: Create DEB Package (Linux 64-bits)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: |
cp -Rf scripts/deb build/
mkdir -p build/deb/ufprog/opt/ufprog
cp -f build/ufprog build/deb/ufprog/opt/ufprog/
cp -Rf resources/linux/* build/deb/ufprog/
chmod 775 build/deb/ufprog/DEBIAN/*
chmod +x build/deb/ufprog/opt/ufprog/ufprog
cd build/deb
dpkg -b ufprog
mv ufprog.deb "${{env.SOFTWARE_PROJECT_DIR}}/build/ufprog-${{env.BUILD_VERSION}}-${{env.BUILD_REVISION}}-x86_64.deb"
- if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64'
name: Create RPM Package (Linux 64-bits)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: |
cp -Rf scripts/rpm build/
mkdir -p build/rpm/ufprog/{BUILD,BUILDROOT,RPMS,SRPMS,SOURCES}
mkdir -p build/rpm/ufprog/SOURCES/opt/ufprog
cp -f build/ufprog build/rpm/ufprog/SOURCES/opt/ufprog/
cp -Rf resources/linux/usr build/rpm/ufprog/SOURCES/
chmod 775 build/rpm/ufprog/SOURCES/*
chmod +x build/rpm/ufprog/SOURCES/opt/ufprog/ufprog
cd build/rpm/ufprog
sed -i "/^[[:space:]]*Version:/ s/:.*/: ${{env.BUILD_VERSION}}/" SPECS/ufprog.spec
sed -i "/^[[:space:]]*Release:/ s/:.*/: ${{env.BUILD_REVISION}}/" SPECS/ufprog.spec
rpmbuild -bb SPECS/ufprog.spec
mv RPMS/x86_64/ufprog*.rpm "${{env.SOFTWARE_PROJECT_DIR}}/build/"
- if: matrix.os == 'macos-latest' && matrix.arch == 'x86_64'
name: Create the Installer (MacOS)
working-directory: ${{env.SOFTWARE_PROJECT_DIR}}
run: |
cd build/Release
/usr/local/opt/qt@5/bin/macdeployqt "ufprog.app" -dmg
cp ufprog.dmg "${{env.SOFTWARE_PROJECT_DIR}}/build/ufprog-${{env.BUILD_VERSION}}-${{env.BUILD_REVISION}}.dmg"
# ------------------------------------------------------------------------
# Upload the Installer
# ------------------------------------------------------------------------
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86_64'
name: Upload the Installer (Windows 64-bits)
uses: actions/upload-artifact@v3
with:
path: "${{env.SOFTWARE_PROJECT_DIR}}/build/ufprog-*setup.exe"
name: "ufprog-win64-installer"
- if: matrix.os == 'windows-latest' && matrix.arch == 'x86'
name: Upload the Installer (Windows 32-bits)
uses: actions/upload-artifact@v3
with:
path: "${{env.SOFTWARE_PROJECT_DIR}}/build/ufprog-*setup.exe"
name: "ufprog-win32-installer"
- if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x86_64'
name: Upload the Packages (Linux 64-bits)
uses: actions/upload-artifact@v3
with:
path: "${{env.SOFTWARE_PROJECT_DIR}}/build/ufprog-*-*.*"
name: "ufprog-linux64-packages"
- if: matrix.os == 'macos-latest' && matrix.arch == 'x86_64'
name: Upload the Installer (MacOS)
uses: actions/upload-artifact@v3
with:
path: "${{env.SOFTWARE_PROJECT_DIR}}/build/ufprog-*.dmg"
name: "ufprog-macos-installer"
build_software_freebsd:
name: Build Software (FreeBSD)
runs-on: ubuntu-22.04
steps:
# ------------------------------------------------------------------------
# Checkout the sources
# ------------------------------------------------------------------------
- uses: actions/checkout@v4
- name: Build in FreeBSD
uses: vmactions/freebsd-vm@v1
with:
release: 13.2
usesh: true
mem: 8192
# ------------------------------------------------------------------------
# Install Prerequisites
# ------------------------------------------------------------------------
prepare: |
pkg install -y curl bash cmake devel/qt5
run: |
# ------------------------------------------------------------------------
# Configure CMake
# ------------------------------------------------------------------------
cd software/usbflashprog
cmake -B build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
# ------------------------------------------------------------------------
# Build
# ------------------------------------------------------------------------
cmake --build build --config ${{env.BUILD_TYPE}}
export BUILD_VERSION=`cat VERSION`
export BUILD_REVISION=`date +%y%m%d`
# ------------------------------------------------------------------------
# Create the Installer
# ------------------------------------------------------------------------
cp -Rf scripts/freebsd build/
mkdir -p build/freebsd/ufprog/opt/ufprog
cp -f build/ufprog build/freebsd/ufprog/opt/ufprog/
mkdir -p build/freebsd/ufprog/usr/local
cp -Rf resources/linux/usr/share build/freebsd/ufprog/usr/local/
chmod +x build/freebsd/ufprog/opt/ufprog/ufprog
cd build/freebsd/ufprog
sed -i '' -e "/^[[:space:]]*version:/ s/:.*/: \"$BUILD_VERSION\"/" "+MANIFEST"
cat "+MANIFEST"
pkg create -v -m `pwd`/ -r `pwd`/ -p `pwd`/plist -o .
mv ufprog-$BUILD_VERSION.pkg "../../ufprog-$BUILD_VERSION-$BUILD_REVISION-x86_64.pkg"
# ------------------------------------------------------------------------
# Upload the Installer
# ------------------------------------------------------------------------
- name: Upload the Package (FreeBSD)
uses: actions/upload-artifact@v3
with:
path: "${{env.SOFTWARE_PROJECT_DIR}}/build/ufprog-*-*.*"
name: "ufprog-freebsd_amd64-package"