Skip to content

Create a cmake target for the commons library #35

Create a cmake target for the commons library

Create a cmake target for the commons library #35

name: Windows cmake build and test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
name: Build and test local
if: github.repository_owner == 'ParadoxGameConverters'
runs-on: [self-hosted, windows]
steps:
- name: work around permission issue
run: git config --global --add safe.directory /github/workspace
- name: Add Ninja build to PATH
run: echo "c:\program files\ninja" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Cloning repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Build with cmake
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
cmake --preset x64-release-windows
cmake --build --preset build-x64-release-windows --target commonLib CommonItemsTests -- -j40
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\x64-release-windows
.\CommonItemsTests.exe
- name: "Cleanup"
if: always()
run: |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse
build_test:
name: Build and test foreign
if: github.repository_owner != 'ParadoxGameConverters'
runs-on: windows-2022
steps:
- name: "Cloning repo"
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install ninja
run: |
choco install ninja
- name: Build with cmake
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cmake --preset x64-release-windows
cmake --build --preset build-x64-release-windows --target commonLib -- -j40
- name: "Run tests"
run: |
cd $Env:GITHUB_WORKSPACE\build\x64-release-windows
.\CommonItemsTests.exe
- name: "Cleanup"
if: always()
run: |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | Remove-Item -force -recurse