-
Notifications
You must be signed in to change notification settings - Fork 15
151 lines (133 loc) Β· 5.24 KB
/
build-windows.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
---
name: πͺ Build - Windows
on:
push:
branches:
- main
pull_request:
release:
types: ['published']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: build (windows)
runs-on: windows-2019
steps:
- name: π£ Checkout
uses: actions/checkout@v4
- name: π© Install CMake and Ninja
uses: lukka/get-cmake@latest
with:
# Pin to specific version to avoid rebuilding too often
# Also helps to avoid spurious build failures like https://github.com/qgis/QGIS/pull/47098
cmakeVersion: 3.29.0
- name: 𧽠Developer Command Prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@v1
- name: π¦ Prepare msi
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
shell: bash
run: |
echo "CREATE_MSI_CMAKE_VAR=-D CREATE_MSI=ON" >> $GITHUB_ENV
- name: π± Install dependencies and generate project files
shell: bash
run: |
RELEASE=$(curl -s "https://api.github.com/repos/kadas-albireo/kadas-albireo2/tags" | jq -r '.[0].name')
MAJOR=$(echo ${RELEASE:1} | cut -d. -f1)
MINOR=$(echo ${RELEASE} | cut -d. -f2)
PATCH=$(echo ${RELEASE} | cut -d. -f3 | cut -d- -f1)
PRE=$(echo ${RELEASE} | cut -s -d- -f2)
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
PRE="${PRE}-PR${{ github.event.pull_request.number }}"
fi
echo "KADAS Version: v${MAJOR}.${MINOR}.${PATCH}-${PRE}"
cmake -S . \
-G Ninja \
-B build \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX="C:\kadas" \
-D WITH_BINDINGS=ON \
-D INSTALL_DEMO_DATA=ON \
-D VCPKG_TARGET_TRIPLET="x64-windows" \
-D VCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:/src" \
-D SIP_BUILD_EXECUTABLE="$(pwd)\build\vcpkg_installed\x64-windows\tools\python3\Scripts\sip-build.exe" \
-D QGIS_PYTHON_MODULE_DIR="$(pwd)\build\vcpkg_installed\x64-windows\tools\python3\Lib\site-packages\qgis" \
-D CPACK_PACKAGE_FILE_NAME="kadas-win64-$(date +'%Y-%m-%d_%H%M')" \
-D NUGET_USERNAME=kadas-albireo \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-D KADAS_VERSION_MAJOR=${MAJOR} \
-D KADAS_VERSION_MINOR=${MINOR} \
-D KADAS_VERSION_PATCH=${PATCH} \
-D KADAS_VERSION_PRE=${PRE} \
${CREATE_MSI_CMAKE_VAR}
- name: π Upload vcpkg build logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: build-logs-x64-windows
path: |
C:/src/**/*.log
- name: π¦ Create SDK
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
run: |
./build/_deps/vcpkg-src/vcpkg.exe export --zip --output-dir=./sdk --x-install-root=build/vcpkg_installed --x-manifest-root=vcpkg
- name: π€ Upload sdk
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: kadas-albireo2-sdk-x64-windows
path: |
sdk/vcpkg-export-*.zip
- name: Compile plugins translation
shell: bash
run: |
# lrelease is run from cmake for app
# plugins need to be handled
export PATH="${{ github.workspace }}\build\vcpkg_installed\x64-windows\tools\qt5\bin:${PATH}"
for PLUGIN in about gpkg print; do
lrelease share/python/plugins/kadas_${PLUGIN}/kadas_${PLUGIN}_ts.pro
done
- name: π Build
run: |
cmake --build build --config Release
- name: π¦ Package
run: |
cmake --build build --target bundle --config Release
- name: π€ Upload portable
uses: actions/upload-artifact@v4
with:
name: kadas-albireo2-portable
path: |
build/kadas-*.zip
- name: π€ Upload msi
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
name: kadas-albireo2-msi
path: |
build/kadas-win64-*.msi
# A preliminary smoke test to determine basic functional python
# To be replaced with something proper when testing lands
- name: π PySmokeTest
shell: bash
env:
PYTHONPATH: build/output/python/
run: |
set -e
$(./build/vcpkg_installed/x64-windows/tools/python3/python.exe <<EOF
import os
os.add_dll_directory(os.getcwd() + '/build/output/bin')
from kadas.kadasgui import *
from kadas.kadascore import *
from kadas.kadasanalysis import *
EOF
)
- name: Upload release assets
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'release' }}
with:
files: |
build/kadas-*.zip
build/kadas-*.msi