Skip to content

workflow

workflow #261

Workflow file for this run

name: CMake
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x86
- name: Cache CMake dependency source code
uses: actions/cache@v4
env:
cache-name: cache-cmake-dependency-sources
with:
# CMake cache is at ${{github.workspace}}/build/_deps but we only will cache folders ending in '-src' to cache source code
path: ${{github.workspace}}/build/_deps/*-src
# Cache hash is dependent on CMakeLists files anywhere as these can change what's in the cache, as well as cmake modules files
key: ${{ env.cache-name }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
# it's acceptable to reuse caches for different CMakeLists content if exact match is not available and unlike build caches, we
# don't need to restrict these by OS or compiler as it's only source code that's being cached
restore-keys: |
${{ env.cache-name }}
- name: Cache CMake dependency build objects
uses: actions/cache@v4
env:
cache-name: cache-cmake-dependency-builds
with:
# CMake cache is at ${{github.workspace}}/build/_deps but we only care about the folders ending in -build or -subbuild
path: |
${{github.workspace}}/build/_deps/*-build
${{github.workspace}}/build/_deps/*-subbuild
# Cache hash is dependent on CMakeLists files anywhere as these can change what's in the cache, as well as cmake modules files
key: ${{ env.cache-name }}-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
# it's acceptable to reuse caches for different CMakeLists content if exact match is not available
# as long as the OS and Compiler match exactly
restore-keys: |
${{ env.cache-name }}-${{ runner.os }}-
- name: Configure and build
run: |
if (!(Test-Path "build")) { mkdir build }
mkdir build
cd build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release ../
ninja
- name: Prepare artifacts
run: |
cd build
if (!(Test-Path "output_III")) { mkdir output_III }
if (!(Test-Path "output_VC")) { mkdir output_VC }
if (!(Test-Path "output_SA")) { mkdir output_SA }
cp TrilogyChaosMod.III.asi output_III/TrilogyChaosMod.III.asi
cp TrilogyChaosMod.VC.asi output_VC/TrilogyChaosMod.VC.asi
cp TrilogyChaosMod.SA.asi output_SA/TrilogyChaosMod.SA.asi
- name: Upload III
uses: actions/upload-artifact@v4
with:
name: "TrilogyChaosMod.III"
path: build/output_III
- name: Upload VC
uses: actions/upload-artifact@v4
with:
name: "TrilogyChaosMod.VC"
path: build/output_VC
- name: Upload SA
uses: actions/upload-artifact@v4
with:
name: "TrilogyChaosMod.SA"
path: build/output_SA