-
Notifications
You must be signed in to change notification settings - Fork 152
196 lines (158 loc) · 6.46 KB
/
build_check.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
name: Build_Check
# check if OH6022 builds on some recent operating systems
# deploy Ubuntu / macOS / Windows binaries
on: [push]
env:
# CMake build type (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build_check:
strategy:
# do not stop on 1st fail
fail-fast: false
matrix:
# GitHub runner macos build is broken: https://github.com/actions/runner-images/issues/577
# Could not symlink bin/2to3-3.11 Target /usr/local/bin/2to3-3.11 already exists.
# Could not symlink bin/2to3 Target /usr/local/bin/2to3 already exists.
# hack fix: https://github.com/actions/setup-python/issues/577#issuecomment-1365231822
os: [ubuntu-20.04, macos-11, windows-2022]
runs-on: ${{ matrix.os }}
steps:
# --- Clone the latest commit ---
- name: Checkout
uses: actions/checkout@v3
# --- Config git and get the version from "git describe" ---
- name: Config Git
id: config_git
shell: bash
run: |
git config user.email "[email protected]"
git config user.name "Ho-Ro"
git fetch --prune --unshallow --tags || true
git submodule update --init --recursive
echo "git_describe=$(git describe)"
echo "git_describe=$(git describe)" >> $GITHUB_OUTPUT
# --- Linux (Ubuntu) steps ---
- name: Install Ubuntu Build Requirements
if: startsWith(matrix.os, 'ubuntu')
run: |
mkdir build
sudo apt update
sudo apt -y upgrade
sudo apt install g++ make cmake fakeroot rpm qttools5-dev libfftw3-dev binutils-dev \
libusb-1.0-0-dev libqt5opengl5-dev mesa-common-dev libgl1-mesa-dev libgles2-mesa-dev
- name: Ubuntu Build
# GitHub hosts Linux runners on Standard_DS2_v2 virtual machines in Microsoft Azure:
# 2-core CPU, 7 GB of RAM memory, 14 GB of SSD disk space
working-directory: ${{github.workspace}}/build
if: startsWith(matrix.os, 'ubuntu')
run: |
cp ../CHANGELOG changelog
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
make -j8
fakeroot make -j8 package
ls -l packages
- name: Upload Ubuntu Artifacts
# *.deb *.rpm *.tgz
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v3
with:
name: openhantek_${{ steps.config_git.outputs.git_describe }}_linux_amd64
path: ${{github.workspace}}/build/packages/*
# --- macOS steps ---
- name: Install macOS Build Requirements
if: startsWith(matrix.os, 'macos')
run: |
mkdir build
brew update
brew install qt5 fftw binutils create-dmg || true
# the next two commands (hack from @warpme) fix #314
mkdir -p /usr/local/opt/qt5/lib/libgcc_s.1.1.dylib.framework
ln -sf /usr/local/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib \
/usr/local/opt/qt5/lib/libgcc_s.1.1.dylib.framework/libgcc_s.1.1.dylib
- name: macOS Build
# GitHub hosts macOS runners in GitHub's own macOS Cloud:
# 3-core CPU, 14 GB of RAM memory, 14 GB of SSD disk space
working-directory: ${{github.workspace}}/build
if: startsWith(matrix.os, 'macos')
run: |
cp ../CHANGELOG changelog
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$(brew --prefix qt5)
make -j12
sudo make -j12 package
if test -d openhantek/OpenHantek.app; then
export PATH=$(brew --prefix qt5)/bin:${PATH}
cd openhantek
macdeployqt OpenHantek.app -always-overwrite -verbose=1
python ../../utils/macdeployqtfix/macdeployqtfix.py \
--quiet OpenHantek.app/Contents/MacOS/OpenHantek $(brew --prefix qt5)
create-dmg --volname OpenHantek --volicon ../../openhantek/res/images/openhantek.icns \
--window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "OpenHantek.app" 200 190 \
--skip-jenkins --hide-extension "OpenHantek.app" --app-drop-link 600 185 \
--eula ../../LICENSE OpenHantek.dmg OpenHantek.app
cd ..
else
true
fi
if test -d openhantek/OpenHantek.app; then
cd openhantek ; sudo tar -czf ../packages/openhantek_*_osx_*.tar.gz OpenHantek.app
if test -f OpenHantek.dmg; then
sudo mv OpenHantek.dmg ../packages/$(basename ../packages/openhantek_*_osx_*.tar.gz .tar.gz).dmg
fi
cd ..
ls -l packages
else
true
fi
- name: Upload macOS Artifacts
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v3
with:
name: openhantek_${{ steps.config_git.outputs.git_describe }}_osx_x86_64
path: ${{github.workspace}}/build/packages/*
# --- Windows steps ---
- name: Install MSYS2 Packages
if: startsWith(matrix.os, 'windows')
uses: msys2/setup-msys2@v2
with:
update: true
install: >-
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gcc
mingw-w64-x86_64-qt5-static
mingw-w64-x86_64-fftw
mingw-w64-x86_64-libusb
- name: Start Windows Build
if: startsWith(matrix.os, 'windows')
shell: msys2 {0}
run: |
cmake -D CMAKE_PREFIX_PATH=/mingw64/qt5-static -D CMAKE_BUILD_TYPE=$BUILD_TYPE -B build
cmake --build build --parallel 8 --target package
- name: Create Windows Package
# GitHub hosts Windows runners on Standard_DS2_v2 virtual machines in Microsoft Azure:
# 2-core CPU, 7 GB of RAM memory, 14 GB of SSD disk space
working-directory: ${{github.workspace}}/build
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
# this ZIP package contains only OpenHantek.exe, just get the name
ZIP=$(basename packages/openhantek_*_win_x64.zip)
rm -f packages/openhantek_*_win_x64.*
cd openhantek
7z a ../packages/$ZIP *.exe driver documents
ls -l ../packages
- name: Upload Windows Artifacts
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v3
with:
name: openhantek_${{ steps.config_git.outputs.git_describe }}_win_x64
path: ./build/packages/*.zip
# --- Tagged Commit -> Upload Release ---
- name: Upload Linux / macOS / Windows Release Assets
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
prerelease: true
files: ./build/packages/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}