Skip to content

CI: Use CMakePresets, add sanitizer build #266

CI: Use CMakePresets, add sanitizer build

CI: Use CMakePresets, add sanitizer build #266

Workflow file for this run

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:
config:
- name: Debug
preset: msvc-debug
- name: Release
preset: msvc-release
artifact: windows
env:
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.config.preset }}-${{ hashFiles('.pkg') }}-${{ hashFiles('**/*.h') }}-${{ hashFiles('**/*.cc') }}
restore-keys: |
buildcache-windows-${{ matrix.config.preset }}-${{ hashFiles('.pkg') }}-${{ hashFiles('**/*.h') }}
buildcache-windows-${{ matrix.config.preset }}-${{ hashFiles('.pkg') }}-
buildcache-windows-${{ matrix.config.preset }}-
- 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 ====
- uses: ilammy/msvc-dev-cmd@v1
- name: CMake
run: cmake -S . -B build --preset=${{ matrix.config.preset }}
- name: Build
run: |
.\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.config.artifact != ''
run: |
mkdir dist
mv .\build\*.exe dist
mv .\build\*.dll dist
mv .\ui\web dist
- name: Upload Distribution
if: matrix.config.artifact != ''
uses: actions/upload-artifact@v4
with:
name: ppr-${{ matrix.config.artifact }}
path: dist
# ==== RELEASE ====
- name: Upload Release
if: github.event.action == 'published' && matrix.config.artifact != ''
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./ppr-${{ matrix.config.artifact }}.zip
asset_name: ppr-${{ matrix.config.artifact }}.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 }}