-
-
Notifications
You must be signed in to change notification settings - Fork 240
166 lines (144 loc) ยท 6.14 KB
/
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
name: ๐ช Windows
on:
push:
branches:
- master
- release-**
pull_request:
release:
types: ['published']
jobs:
build:
name: build (windows)
runs-on: windows-2022
steps:
- name: ๐ฃ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: ๐พ Prepare vars
id: vars
shell: bash
run: |
./scripts/ci/env_gh.sh
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CMAKE_BUILD_DIR=C:/builddir" >> $GITHUB_ENV
- name: ๐ฉ Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: ๐งฝ Developer Command Prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@v1
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ccache-windows
variant: sccache
max-size: 50M
- name: ๐จ Prepare build env
shell: bash
run: |
# Hide terminal for release builds
if [[ -n "${{ env.CI_TAG }}" ]]; then
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DCMAKE_WIN32_EXECUTABLE=ON"
fi
echo "EXTRA_CMAKE_ARGS=${EXTRA_CMAKE_ARGS}" >> $GITHUB_ENV
- name: ๐ฑ Install dependencies and generate project files
shell: bash
env:
WORKSPACE: ${{ github.workspace }}
run: |
# Convert paths to bash compatible ones. Thanks to whoever decided to use drive letters and backslashes.
CMAKE_BUILD_DIR=$( cygpath "${CMAKE_BUILD_DIR}" )
SOURCE_DIR=$( cygpath "${WORKSPACE}" )
source ./scripts/version_number.sh
source ./scripts/ci/generate-version-details.sh
cmake -S "${SOURCE_DIR}" \
-G Ninja \
-B "${CMAKE_BUILD_DIR}" \
-D CMAKE_C_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe" \
-D CMAKE_CXX_COMPILER="C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe" \
-D CMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-D VCPKG_TARGET_TRIPLET="x64-windows-static" \
-D WITH_VCPKG=ON \
-D WITH_SPIX=ON \
-D WITH_NFC=OFF \
-D APP_VERSION="${APP_VERSION}" \
-D APP_VERSION_STR="${APP_VERSION_STR}" \
-D APP_PACKAGE_NAME="${APP_PACKAGE_NAME}" \
-D ENABLE_TESTS=OFF \
-D NUGET_USERNAME=opengisch \
-D NUGET_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-D SENTRY_DSN=${{ secrets.SENTRY_DSN }} \
-D SENTRY_ENV="${APP_ENV}" \
-D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded\$<\$<CONFIG:Debug>:Debug>" \
-D PKG_CONFIG_EXECUTABLE=${CMAKE_BUILD_DIR}/vcpkg_installed/x64-windows/tools/pkgconf/pkgconf.exe \
-D WITH_BLUETOOTH=OFF `# Not yet properly tested/supported and we have a conflict of double defined symbol in QtBluetooth/QtMultimedia` \
-D VCPKG_INSTALL_OPTIONS="--x-buildtrees-root=C:/src" \
-D WITH_CCACHE=ON \
-D CCACHE_PROGRAM="C:/Users/runneradmin/.cargo/bin/sccache.exe" \
${EXTRA_CMAKE_ARGS}
- name: ๐ Upload dep build logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: build-logs-x64-windows-static
path: |
C:/src/**/*.log
- name: ๐ Build
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --config ${{ env.BUILD_TYPE }}
- name: ๐งซ Test
shell: bash
env:
PROJ_LIB: ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/x64-windows-static/share/proj
run: |
SOURCE_DIR=$( cygpath "${{ github.workspace }}" )
pip install -r "${SOURCE_DIR}/test/spix/requirements.txt"
cd "${{ env.CMAKE_BUILD_DIR }}"
ctest --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: Package
shell: bash
run: |
cmake --build "${{ env.CMAKE_BUILD_DIR }}" --target bundle --config ${{ env.BUILD_TYPE }} -j1
ARTIFACT_PATHNAME=$(ls ${{ env.CMAKE_BUILD_DIR }}/QField-*-win64.* | head -n 1)
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME)
echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV
echo "ARTIFACT_NAME=qfield-${{ env.CI_PACKAGE_FILE_SUFFIX }}-windows-x64.exe" >> $GITHUB_ENV
- name: ๐ Upload package logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: package-logs-x64-windows-static
path: ${{ env.CMAKE_BUILD_DIR }}/_CPack_Packages/**/*.log
- name: ๐ฆ Upload package
if: ${{ env.ARTIFACT_NAME != null }}
uses: actions/upload-artifact@v3
with:
name: "QField-dev-x64-windows-static-${{ env.BUILD_TYPE }}"
path: ${{ env.ARTIFACT_PATHNAME }}
- name: ๐ Upload test report
uses: actions/upload-artifact@v3
with:
name: "test-report-x64-windows-static-${{ env.BUILD_TYPE }}"
path: "${{ env.CMAKE_BUILD_DIR }}/report"
- name: ๐ Upload release asset
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && env.ARTIFACT_NAME != null
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ARTIFACT_PATHNAME }}
asset_name: ${{ env.ARTIFACT_NAME }}
overwrite: true
- name: ๐ Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: ๐ฎ Upload debug symbols
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') && env.ARTIFACT_NAME != null
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG_SLUG: opengisch
SENTRY_PROJECT_SLUG: qfield
run: |
bundle exec fastlane run sentry_upload_dif path:${{ env.CMAKE_BUILD_DIR }}