Update build.yml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake Build | |
on: | |
push: | |
branches: [ main ] | |
release: | |
types: [ created ] | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
preset: [ x64-debug ] | |
steps: | |
- name: Set up CMake | |
uses: lukka/get-cmake@latest | |
with: | |
cmakeVersion: "~3.28.0" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup VS environment | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
- name: Build and install debug | |
run: | | |
cmake --preset x64-debug . | |
cmake --build build/x64-debug -j12 | |
- name: Build and install release | |
run: | | |
cmake --preset x64-Release . | |
cmake --build build/x64-Release -j12 | |
cmake --install build/x64-Release | |
- name: Copy debug artifacts | |
run: | | |
mkdir _dist-debug | |
Copy-Item build/x64-debug/src/* -Destination _dist-debug/ -Recurse | |
- name: Copy release artifacts | |
run: | | |
mkdir _dist-release | |
Copy-Item _install/x64-Release/bin/* -Destination _dist-release/ -Recurse | |
- name: Archive debug NavKit | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NavKit-Debug | |
path: _dist-debug/* | |
- name: Archive release Navkit | |
uses: actions/upload-artifact@v4 | |
with: | |
name: NavKit-Release | |
path: _dist-release/* | |
upload_release: | |
name: Upload artifacts | |
needs: build | |
#if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
artifact: | |
- NavKit-Release | |
- NavKit-Debug | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.artifact }} | |
path: ${{ matrix.artifact }} | |
- name: Archive artifact files | |
run: | | |
cd ${{ matrix.artifact }} | |
zip -r ${{ matrix.artifact }}.zip * |