-
Notifications
You must be signed in to change notification settings - Fork 5
121 lines (105 loc) · 4 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
name: Windows Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types:
- published
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
mode: [ Debug, Release ]
env:
CXX: cl.exe
CC: cl.exe
BUILDCACHE_COMPRESS: true
BUILDCACHE_DIRECT_MODE: true
BUILDCACHE_DIR: ${{ github.workspace }}/.buildcache
BUILDCACHE_ACCURACY: SLOPPY
BUILDCACHE_LUA_PATH: ${{ github.workspace }}/tools
CLICOLOR_FORCE: 1
steps:
- uses: actions/checkout@v4
- name: Install ninja
run: choco install ninja
# ==== RESTORE CACHE ====
- name: Restore buildcache Cache
uses: actions/cache/restore@v4
id: restore-buildcache
with:
path: ${{ github.workspace }}/.buildcache
key: buildcache-windows-${{ matrix.mode }}-${{ hashFiles('.pkg') }}-${{ hashFiles('**/*.h') }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
buildcache-windows-${{ matrix.mode }}-${{ hashFiles('.pkg') }}-${{ hashFiles('**/*.h') }}
buildcache-windows-${{ matrix.mode }}-${{ hashFiles('.pkg') }}-
buildcache-windows-${{ matrix.mode }}-
- name: Restore Dependencies Cache
uses: actions/cache/restore@v4
id: restore-deps-cache
with:
path: ${{ github.workspace }}/deps
key: deps-${{ hashFiles('.pkg') }}
restore-keys: deps-
# ==== BUILD ====
- name: Build
run: |
$devShell = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -find **\Microsoft.VisualStudio.DevShell.dll
$installPath = &"${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationpath
Import-Module $devShell
Enter-VsDevShell -VsInstallPath $installPath -SkipAutomaticLocation -DevCmdArguments "-arch=amd64"
Get-ChildItem env:
cmake -GNinja -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.mode }} -DPPR_DEBUG_SYMBOLS=OFF -DPPR_MIMALLOC=ON
.\build\buildcache\bin\buildcache.exe -z
cmake --build build --target ppr-preprocess ppr-backend footrouting ppr-benchmark ppr-test
$CompilerExitCode = $LastExitCode
Copy-Item ${env:VCToolsRedistDir}x64\Microsoft.VC143.CRT\*.dll .\build\
.\build\buildcache\bin\buildcache.exe -s
exit $CompilerExitCode
- name: Run Tests
run: .\build\ppr-test.exe
# ==== DISTRIBUTION ====
- name: Create Distribution
if: matrix.mode == 'Release'
run: |
mkdir dist
mv .\build\*.exe dist
mv .\build\*.dll dist
mv .\ui\web dist
- name: Upload Distribution
if: matrix.mode == 'Release'
uses: actions/upload-artifact@v4
with:
name: ppr-windows
path: dist
# ==== RELEASE ====
- name: Upload Release
if: github.event.action == 'published' && matrix.mode == 'Release'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./ppr-windows.zip
asset_name: ppr-windows.zip
asset_content_type: application/zip
# ==== SAVE CACHE ====
- name: Save buildcache Cache
if: always() && steps.restore-buildcache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/.buildcache
key: ${{ steps.restore-buildcache.outputs.cache-primary-key }}
- name: Save Dependencies Cache
if: always() && steps.restore-deps-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/deps
key: ${{ steps.restore-deps-cache.outputs.cache-primary-key }}