-
Notifications
You must be signed in to change notification settings - Fork 42
295 lines (295 loc) · 10.3 KB
/
build.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
name: CI
on: [push, pull_request]
permissions:
contents: read
env:
BUILD_NUMBER: ${{ github.run_number }}
MAKEFLAGS: -j3
jobs:
macos:
name: Build on macOS
runs-on: macos-latest
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: master
name: pkgs
path: libdigidocpp-pkg
repo: open-eid/libdigidocpp
- name: Install dependencies
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: YES
run: |
brew install ninja flatbuffers
HASH=($(shasum prepare_osx_build_environment.sh))
curl -O -L -s https://installer.id.ee/media/github/opensc_0.22.0.pkg
curl -O -L -s https://installer.id.ee/media/github/${HASH}.zip
sudo installer -verboseR -pkg libdigidocpp-pkg/libdigidocpp*.pkg -target /
sudo installer -verboseR -pkg opensc_*.pkg -target /
sudo unzip -qq -d /Library/Developer ${HASH}.zip
- name: Build
run: |
QT_DIR=$(ls -d /Library/Developer/Qt-*-OpenSSL | tail -n 1)
cmake "-GNinja" \
-DCMAKE_PREFIX_PATH=${QT_DIR} \
-DOPENSSL_ROOT_DIR=/Library/Developer/OpenSSL \
-DLDAP_ROOT=/Library/Developer/OpenLDAP \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -B build -S .
cmake --build build --target zipdebug macdeployqt zip
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: pkgs
path: build/qdigidoc4*.zip
ubuntu:
name: Build on Ubuntu to ${{ matrix.container }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
matrix:
container: ['ubuntu:20.04', 'ubuntu:22.04', 'ubuntu:23.04']
env:
DEBIAN_FRONTEND: noninteractive
DEBFULLNAME: github-actions
DEBEMAIL: [email protected]
steps:
- name: Install dependencies
if: matrix.container == 'ubuntu:20.04'
run: apt update -qq && apt install --no-install-recommends -y git lsb-release fakeroot build-essential devscripts debhelper pkg-config cmake libldap2-dev gettext libpcsclite-dev libssl-dev libqt5svg5-dev qttools5-dev-tools qttools5-dev lintian libflatbuffers-dev zlib1g-dev
- name: Install dependencies
if: matrix.container != 'ubuntu:20.04'
run: apt update -qq && apt install --no-install-recommends -y git lsb-release fakeroot build-essential devscripts debhelper pkg-config cmake libldap2-dev gettext libpcsclite-dev libssl-dev libgl-dev libqt6svg6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libqt6core5compat6-dev lintian libflatbuffers-dev zlib1g-dev
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: master
name: debs
path: libdigidocpp-pkg
repo: open-eid/libdigidocpp
- name: Install artifact
run: |
apt install --no-install-recommends -y ./libdigidocpp-pkg/*$(lsb_release -rs)*.deb
rm -rf libdigidocpp-pkg
- name: Setup changelog
run: |
export VERSION=$(grep project CMakeLists.txt | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
export VERSIONEX=${VERSION}.${BUILD_NUMBER}.$(lsb_release -rs)
dch --distribution $(lsb_release -cs) -v ${VERSIONEX} "Release ${VERSIONEX}."
- name: Build packages
run: |
dpkg-buildpackage -us -uc
mv ../qdigidoc4*.* .
- name: Lintian
run: lintian *.deb;
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: debs
path: qdigidoc4*.*
fedora:
name: Build on Fedora to ${{ matrix.container }}
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
matrix:
container: ['fedora:37', 'fedora:38']
env:
MAKEFLAGS: -j3
steps:
- name: Install Deps
run: dnf install -y git gcc-c++ cmake rpm-build gettext openssl-devel openldap-devel pcsc-lite-devel qt6-qtsvg-devel qt6-qttools-devel qt6-qt5compat-devel flatbuffers-devel flatbuffers-compiler zlib-devel
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: master
name: rpms
path: libdigidocpp-pkg
repo: open-eid/libdigidocpp
- name: Install artifact
run: |
. /etc/os-release
dnf install -y ./libdigidocpp-pkg/*fc${VERSION_ID}*.rpm
- name: Build
run: |
cmake -DCMAKE_INSTALL_PREFIX=/usr -B build -S .
cmake --build build --target all package
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: rpms
path: build/qdigidoc4*.rpm
windows:
name: Build on Windows
runs-on: ${{ matrix.image }}
strategy:
matrix:
vcver: [142, 143]
include:
- vcver: 142
image: windows-2019
- vcver: 143
image: windows-2022
env:
VER_SUFFIX: .VS${{ matrix.vcver }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: master
name: msi
path: ./
repo: open-eid/libdigidocpp
- name: Install artifact
run: |
Rename-Item "libdigidocpp*VS${{ matrix.vcver }}.msi" libdigidocpp.msi
msiexec /qn /a libdigidocpp.msi "TARGETDIR=$($pwd.Path)\\libs"
- name: Prepare vcpkg
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: openssl zlib flatbuffers
vcpkgGitCommitId: 6a349fe1fbea1e5fcda2e0775f555d829a5e82df
vcpkgTriplet: x64-windows
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.5.3
arch: win64_msvc2019_64
modules: qt5compat
- name: Setup dev env
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
sdk: 10.0.19041.0
- name: Build
run: |
md build/client
copy ${{ env.RUNVCPKG_VCPKG_ROOT }}\installed\x64-windows\bin\*.dll build\client\
cmake "-GNinja" -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_TOOLCHAIN_FILE=${{ env.RUNVCPKG_VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake `
"-DLibDigiDocpp_ROOT=libs/libdigidocpp"
cmake --build build --target msi
cmake --build build --target appx
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: msi
path: |
build/*.msi
build/*.appx
coverity:
name: Run Coverity tests
if: github.repository == 'open-eid/DigiDoc4-Client' && contains(github.ref, 'coverity_scan')
runs-on: ubuntu-22.04
env:
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
PROJECTNAME: open-eid/DigiDoc4-Client
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt update -qq && sudo apt install --no-install-recommends -y cmake libldap2-dev gettext libpcsclite-dev libminizip-dev libxml-security-c-dev libgl-dev libqt6svg6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libqt6core5compat6-dev libflatbuffers-dev zlib1g-dev
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: master
name: debs
path: libdigidocpp-pkg
repo: open-eid/libdigidocpp
- name: Install artifact
run: sudo dpkg -i libdigidocpp-pkg/*$(lsb_release -rs)*.deb
- name: Download Coverity Build Tool
run: |
curl -s -d "token=$TOKEN&project=$PROJECTNAME" -o cov-analysis-linux64.tar.gz https://scan.coverity.com/download/cxx/linux64
mkdir cov-analysis-linux64
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
- name: Build
run: |
cmake .
export PATH=$PWD/cov-analysis-linux64/bin:$PATH
cov-build --dir cov-int make
- name: Submit the result to Coverity Scan
run: |
tar czvf upload.tgz cov-int
curl -s \
-F project=$PROJECTNAME \
-F token=$TOKEN \
-F [email protected] \
-F [email protected] \
-F version=master \
-F description="Github Actions CI build" \
https://scan.coverity.com/builds?project=$PROJECTNAME
codeql:
name: Run CodeQL tests
if: github.repository == 'open-eid/DigiDoc4-Client'
runs-on: ubuntu-22.04
permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: sudo apt update -qq && sudo apt install --no-install-recommends -y cmake libldap2-dev gettext libpcsclite-dev libminizip-dev libxml-security-c-dev libgl-dev libqt6svg6-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libqt6core5compat6-dev libflatbuffers-dev zlib1g-dev
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: build.yml
branch: master
name: debs
path: libdigidocpp-pkg
repo: open-eid/libdigidocpp
- name: Install artifact
run: sudo dpkg -i libdigidocpp-pkg/*$(lsb_release -rs)*.deb
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: cpp
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
upload: False
output: sarif-results
- name: Filter results
uses: advanced-security/filter-sarif@develop
with:
patterns: |
-**/*autogen*/**
-**/common/qtsingleapplication/**
-**:cpp/loop-variable-changed
-**:cpp/poorly-documented-function
input: sarif-results/cpp.sarif
output: sarif-results/cpp.sarif
- name: Upload results
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: sarif-results/cpp.sarif