forked from chrstnbwnkl/valhalla
-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (157 loc) · 6.13 KB
/
win.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
name: Windows CI
on:
push:
paths-ignore:
- "*.md"
- .circleci/
- docs/
- run_route_scripts/
- test/
- test_requests/
branches:
- master
- chinesepostman
pull_request:
paths-ignore:
- "*.md"
- .circleci/
- docs/
- run_route_scripts/
- test/
- test_requests/
branches:
- master
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
env:
BUILD_TYPE: Release
MSVC_VERSION: "2022"
VCPKG_VERSION: "5e5d0e1"
VCPKG_INSTALL_OPTIONS: --x-abi-tools-use-exact-versions
VCPKG_DISABLE_COMPILER_TRACKING: ON
jobs:
build_win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# we add a custom triplet to avoid cache misses as much as possible
# https://github.com/microsoft/vcpkg/issues/26346#issuecomment-1319244766
- name: Configure vckpg
shell: bash
run: |
echo "VCPKG_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV
echo "VCPKG_OVERLAY_TRIPLETS=${{ github.workspace }}/vcpkg/custom-triplets" >> $GITHUB_ENV
echo "VCPKG_DEFAULT_TRIPLET=custom-x64-windows" >> $GITHUB_ENV
echo "VCPKG_DEFAULT_BINARY_CACHE=${{ github.workspace }}/vcpkg/archives" >> $GITHUB_ENV
- name: Install GNU make & awk
run: choco install gawk make
- name: Install vcpkg
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
git checkout $VCPKG_VERSION
mkdir archives
mkdir "$VCPKG_OVERLAY_TRIPLETS"
TRIPLET_FILE="$VCPKG_OVERLAY_TRIPLETS/$VCPKG_DEFAULT_TRIPLET.cmake"
cp triplets/x64-windows.cmake "$TRIPLET_FILE"
echo "set(VCPKG_BUILD_TYPE release)" >> "$TRIPLET_FILE"
echo "set(VCPKG_DISABLE_COMPILER_TRACKING $VCPKG_DISABLE_COMPILER_TRACKING)" >> "$TRIPLET_FILE"
cmd.exe /c bootstrap-vcpkg.bat
# make sure we save vcpkg packages even if build fails
# note, we don't use vcpkg "command line" mode, but "cmake manifest" mode
- name: Restore vcpkg packages
id: vcpkg-restore
uses: actions/cache/restore@v3
with:
key: vcpkg=${{ env.VCPKG_VERSION }}-msvc=${{ env.MSVC_VERSION }}-json=${{ hashFiles('vcpkg.json') }}
path: |
vcpkg/*
!vcpkg/downloads
!vcpkg/docs
!vcpkg/buildtrees
vcpkg/downloads/tools
- name: Setup Developer Command Prompt for VS
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
shell: bash
run: |
cmake --version
cmake -B build \
-G "Visual Studio 17 2022" \
-A x64 \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_TOOLCHAIN_FILE="$VCPKG_TOOLCHAIN_FILE" \
-DVCPKG_OVERLAY_TRIPLETS="$VCPKG_OVERLAY_TRIPLETS" \
-DVCPKG_TARGET_TRIPLET="$VCPKG_DEFAULT_TRIPLET" \
-DVCPKG_INSTALL_OPTIONS="$VCPKG_INSTALL_OPTIONS" \
-DENABLE_DATA_TOOLS=ON \
-DENABLE_TOOLS=ON \
-DENABLE_PYTHON_BINDINGS=OFF \
-DENABLE_HTTP=ON \
-DENABLE_TESTS=OFF \
-DENABLE_CCACHE=OFF \
-DENABLE_SERVICES=OFF \
-DLOGGING_LEVEL=INFO \
-DPREFER_EXTERNAL_DEPS=ON \
-DENABLE_GDAL=ON \
-DBUILD_MSI=ON \
-DX_VCPKG_APPLOCAL_DEPS_INSTALL=ON
- name: Save vcpkg packages (always, to avoid redundant rebuilds)
uses: actions/cache/save@v3
with:
key: ${{ steps.vcpkg-restore.outputs.cache-primary-key }}
path: |
vcpkg/*
!vcpkg/downloads
!vcpkg/docs
!vcpkg/buildtrees
vcpkg/downloads/tools
- name: Build Valhalla
run: |
cmake --build build --config Release -- /clp:ErrorsOnly /p:BuildInParallel=true /m:4
- name: Test Executable
shell: bash
run: |
set PATH=$PATH:${{ github.workspace }}/build/vcpkg_installed/$BUILD_TYPE/bin
./build/$BUILD_TYPE/valhalla_build_tiles.exe -c ./test/win/valhalla.json ./test/data/utrecht_netherlands.osm.pbf
./build/$BUILD_TYPE/valhalla_run_isochrone.exe --config ./test/win/valhalla.json -j "{\"locations\": [{\"lat\": 52.10205, \"lon\": 5.114651}], \"costing\": \"auto\", \"contours\":[{\"time\":15,\"color\":\"ff0000\"}]}"
./build/$BUILD_TYPE/valhalla_service.exe ./test/win/valhalla.json isochrone "{\"locations\": [{\"lat\": 52.10205, \"lon\": 5.114651}], \"costing\": \"auto\", \"contours\":[{\"time\":15,\"color\":\"ff0000\"}]}"
- name: Create .msi build
run: |
cmake --build build --target bundle --config Release
- name: Sign .msi
if: github.event_name == 'workflow_dispatch'
uses: azure/[email protected]
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://weu.codesigning.azure.net/
code-signing-account-name: OPENGISch
certificate-profile-name: OPENGISch
files-folder: build/_CPack_Packages/win64/WIX
files-folder-filter: msi
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- name: Create .msi artifact
uses: actions/upload-artifact@v4
with:
name: valhalla
path: |
build/_CPack_Packages/win64/WIX/*.msi
build/_CPack_Packages/win64/ZIP/*.zip
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
# only run this if manually invoked or a previous job failed
if: ${{ (github.event_name == 'workflow_dispatch' && inputs.debug_enabled) || failure() }}
with:
detached: true