-
Notifications
You must be signed in to change notification settings - Fork 189
218 lines (190 loc) · 7.51 KB
/
Copy pathbuild.yml
File metadata and controls
218 lines (190 loc) · 7.51 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
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
compiler: [msvc, gcc, clang]
qt_version: [qt5, qt6]
exclude:
- os: ubuntu-latest
compiler: msvc
- os: macos-latest
compiler: gcc
- os: macos-latest
compiler: msvc
- os: windows-latest
compiler: clang
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup CMake and Ninja
uses: lukka/get-cmake@latest
- if: matrix.compiler == 'msvc'
uses: ilammy/msvc-dev-cmd@v1
- name: Install Dependencies (Windows only)
if: runner.os == 'Windows'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install pkgconfiglite
- name: Install Qt (Mac/Linux only)
if: runner.os != 'Windows'
run: |
if [ '${{ runner.os }}' == 'macOS' ]; then
if [ '${{ matrix.qt_version }}' == 'qt6' ]; then
brew install qt6 pkg-config
brew link qt6 --force
echo "$(brew --prefix qt6)/bin" >> $GITHUB_PATH
else
brew install qt5 pkg-config
brew link qt5 --force
echo "$(brew --prefix qt5)/bin" >> $GITHUB_PATH
fi
elif [ '${{ runner.os }}' == 'Linux' ]; then
sudo apt-get update
if [ '${{ matrix.qt_version }}' == 'qt6' ]; then
sudo apt-get install -y qt6-base-dev qtchooser qmake6 qt6-base-dev-tools qt6-tools-dev pkg-config libsecret-1-dev
else
sudo apt-get install -y qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools qttools5-dev pkg-config libsecret-1-dev
fi
fi
- name: Set AQT Version and Arch (Windows only)
if: runner.os == 'Windows'
id: set_qt_arch
shell: pwsh
run: |
$qtVer = "${{ matrix.qt_version == 'qt5' && '5.15.2' || '6.5.3' }}"
$qtArch = "${{ matrix.compiler == 'msvc' && 'msvc2019_64' ||
matrix.qt_version == 'qt5' && matrix.compiler == 'gcc' && 'mingw81' ||
matrix.qt_version == 'qt6' && matrix.compiler == 'gcc' && 'mingw' }}"
echo "QT_VER=$qtVer" >> $env:GITHUB_OUTPUT
echo "QT_ARCH=$qtArch" >> $env:GITHUB_OUTPUT
- name: Install Qt (Windows only)
if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v4
with:
version: ${{ steps.set_qt_arch.outputs.QT_VER }}
arch: win64_${{ steps.set_qt_arch.outputs.QT_ARCH }}
dir: 'C:\'
cache: true
tools: 'tools_mingw1310'
- name: Setup Build Directory
run: |
mkdir -p ${{ github.workspace }}/work/build/${{ github.event.repository.name }}
- name: Run CMake (Windows only)
if: runner.os == 'Windows'
shell: pwsh
run: |
if ( '${{ matrix.compiler }}' -eq 'msvc' ) {
$generator = "NMake Makefiles"
} else {
$generator = "MinGW Makefiles"
}
if ( '${{ matrix.compiler }}' -eq 'gcc' ) {
echo "C:/Qt/Tools/mingw1310_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:PATH = "C:\Qt\Tools\mingw1310_64\bin;$env:PATH"
}
cd "${{ github.workspace }}/work/build/${{ github.event.repository.name }}"
cmake -G $generator "${{ github.workspace }}" `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" `
-DCMAKE_PREFIX_PATH=$env:QT_ROOT_DIR `
${{ matrix.qt_version == 'qt6' && '-DBUILD_WITH_QT6=true' || '' }}
- name: Run CMake (Mac/Linux Only)
if: runner.os != 'Windows'
run: |
cd ${{ github.workspace }}/work/build/${{ github.event.repository.name }}
cmake -G Ninja ${{ github.workspace }} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
${{ matrix.qt_version == 'qt6' && '-DBUILD_WITH_QT6=true' || '' }}
- name: Build and Install
run: |
cd ${{ github.workspace }}/work/build/${{ github.event.repository.name }}
cmake --build .
cmake --install . --prefix "${{ github.workspace }}/install"
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.qt_version }}
path: ${{ github.workspace }}/work/build/${{ github.event.repository.name }}
build-android:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install Qt for Android (arm64-v8a)
uses: jurplel/install-qt-action@v4
with:
version: '6.8.3'
target: android
arch: android_arm64_v8a
cache: true
extra: --autodesktop
- name: Build and install qtkeychain (Android)
run: |
cmake -S ${{ github.workspace }} -B build/qtkeychain \
-DCMAKE_TOOLCHAIN_FILE=$QT_ROOT_DIR/lib/cmake/Qt6/qt.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_WITH_QT6=ON \
-DBUILD_TRANSLATIONS=OFF \
-DBUILD_TESTING=OFF
cmake --build build/qtkeychain
cmake --install build/qtkeychain --prefix ${{ github.workspace }}/install
- name: Build TestAppExample (Android)
run: |
cmake -S ${{ github.workspace }}/TestAppExample -B build/testapp \
-DCMAKE_TOOLCHAIN_FILE=$QT_ROOT_DIR/lib/cmake/Qt6/qt.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install \
-DBUILD_WITH_QT6=ON
cmake --build build/testapp
build-ios:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup CMake and Ninja
uses: lukka/get-cmake@latest
- name: Install Qt for iOS
uses: jurplel/install-qt-action@v4
with:
version: '6.8.3'
target: ios
cache: true
extra: --autodesktop
- name: Build and install qtkeychain (iOS)
run: |
cmake -S ${{ github.workspace }} -B build/qtkeychain \
-G Xcode \
-DCMAKE_TOOLCHAIN_FILE=$QT_ROOT_DIR/lib/cmake/Qt6/qt.toolchain.cmake \
-DBUILD_WITH_QT6=ON \
-DBUILD_TRANSLATIONS=OFF \
-DBUILD_TESTING=OFF
cmake --build build/qtkeychain --config Release
cmake --install build/qtkeychain --prefix ${{ github.workspace }}/install --config Release
- name: Build TestAppExample (iOS)
run: |
cmake -S ${{ github.workspace }}/TestAppExample -B build/testapp \
-G Xcode \
-DCMAKE_TOOLCHAIN_FILE=$QT_ROOT_DIR/lib/cmake/Qt6/qt.toolchain.cmake \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/install \
-DBUILD_WITH_QT6=ON \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=NO \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
cmake --build build/testapp --config Release