Added build caching

This commit is contained in:
CptMoore
2024-02-04 10:48:02 +01:00
committed by CptMoore
parent 32cae66229
commit 27db22b96f
2 changed files with 21 additions and 2 deletions
+2
View File
@@ -169,6 +169,8 @@ jobs:
with:
language: ${{ matrix.language }}
assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }}
# TODO check if English and German build faster for code changes on master, if not remove caching
build-cache-enabled: ${{ matrix.language == 'English' || matrix.language == 'German' }}
# at least English and some other lang have to work
continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }}
+19 -2
View File
@@ -13,6 +13,11 @@ on:
required: true
default: true
type: boolean
build-cache-enabled:
description: 'enable sscache'
required: true
default: false
type: boolean
continue-on-error:
description: 'allows a language to fail, used when building all languages'
required: false
@@ -27,6 +32,8 @@ jobs:
fail-fast: false
matrix:
application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor]
env:
SCCACHE_GHA_ENABLED: ${{ inputs.build-cache-enabled }}
steps:
- name: Checkout source
@@ -75,9 +82,19 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86
- name: Prepare build cache
if: ${{ inputs.build-cache-enabled }}
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ inputs.language }}_${{ matrix.application }}
save: ${{ github.ref == 'refs/heads/master' }}
variant: sccache
- name: Prepare build
run: |
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
run: >
cmake -S . -B build -GNinja
-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_BUILD_TYPE=Release
-DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
- name: Build
run: |
cmake --build build/ -- -v