Skip to content

Fix cache condition key #18

Fix cache condition key

Fix cache condition key #18

Workflow file for this run

name: C/C++ CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
strategy:
matrix:
config: [release_x64, release_x86, release_x64dll, release_x86dll, ship_x64, ship_x86, ship_x64dll, ship_x86dll]
runs-on: ubuntu-22.04
steps:
- name: support 32bit
run: |
sudo dpkg --add-architecture i386
sudo apt-get -qq update
sudo apt-get -y install gcc-multilib g++-multilib
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: abel0b/[email protected]
with:
version: "5.0.0-beta2"
# Determine the current submodule commit hash for cache key
- name: Get GoogleBench Submodule Commit
id: submodule_gbench_commit
run: |
cd 3rdparty/source/googlebench
echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Get GoogleTest Submodule Commit
id: submodule_gtest_commit
run: |
cd 3rdparty/source/gtest
echo "::set-output name=commit::$(git rev-parse HEAD)"
# Cache third-party libraries
- name: Cache Third-Party Libraries
id: cache
uses: actions/cache@v4
with:
path: 3rdparty/lib
key: ${{ runner.os }}-third-party-libs-${{ hashFiles('3rdparty/build.sh') }}-${{ hashFiles('3rdparty/premake5.lua') }}-${{ steps.submodule_gbench_commit.outputs.commit }}-${{ steps.submodule_gtest_commit.outputs.commit }}
- name: Build 3rdparty
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd 3rdparty
premake5 gmake2
./build.sh
- name: Generate build files
run: |
premake5 gmake2
- name: Build
run: |
make -j$(nproc) config=${{ matrix.config }}
- name: Test
run: |
./build/${{ matrix.config }}/TDissUnitTester --gtest_output=xml:test_results_${{ matrix.config }}.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.config }}
path: test_results_${{ matrix.config }}.xml