Disable LinkTimeOptimization it makes build tests very slow. #34
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: C/C++ CI | |
on: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- '**.md' # Don't bother building for readme changes etc. | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
linux: | |
strategy: | |
matrix: | |
config: [release_x64, release_x86, release_x64dll, release_x86dll, ship_x64, ship_x86, ship_x64dll, ship_x86dll] | |
toolset: [gcc, clang] | |
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" | |
- name: Install Clang and LLVM tools | |
if: ${{ matrix.toolset == 'clang' }} | |
uses: KyleMayes/install-llvm-action@v2 | |
with: | |
version: 14 | |
# Determine the current submodule commit hash for cache key | |
- name: Get GoogleBench Submodule Commit | |
run: | | |
cd 3rdparty/source/googlebench | |
echo "submodule_gbench_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Get GoogleTest Submodule Commit | |
run: | | |
cd 3rdparty/source/gtest | |
echo "submodule_gtest_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
# 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-${{ matrix.toolset }}-${{ hashFiles('3rdparty/premake5.lua') }}-${{ env.submodule_gbench_commit }}-${{ env.submodule_gtest_commit }} | |
- name: Build 3rdparty | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd 3rdparty | |
premake5 gmake2 --cc=${{ matrix.toolset }} | |
make config=debug_x86 | |
make config=release_x86 | |
make config=ship_x86 | |
make config=debug_x64 | |
make config=release_x64 | |
make config=ship_x64 | |
- name: Generate build files | |
run: | | |
premake5 gmake2 --cc=${{ matrix.toolset }} | |
- 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: ${{ runner.os }}-test-results-${{ matrix.config }} | |
path: test_results_${{ matrix.config }}.xml | |
windows: | |
strategy: | |
matrix: | |
config: | |
- output: release_x64 | |
platform: x64 | |
configuration: Release | |
- output: release_x64dll | |
platform: x64DLL | |
configuration: Release | |
- output: release_x86 | |
platform: Win32 | |
configuration: Release | |
- output: release_x86dll | |
platform: x86DLL | |
configuration: Release | |
- output: ship_x64 | |
platform: x64 | |
configuration: Ship | |
- output: ship_x64dll | |
platform: x64DLL | |
configuration: Ship | |
- output: ship_x86 | |
platform: Win32 | |
configuration: Ship | |
- output: ship_x86dll | |
platform: x86DLL | |
configuration: Ship | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- uses: abel0b/[email protected] | |
with: | |
version: "5.0.0-beta2" | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
# Determine the current submodule commit hash for cache key | |
- name: Get GoogleBench Submodule Commit | |
run: | | |
cd 3rdparty/source/googlebench | |
echo "submodule_gbench_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Get GoogleTest Submodule Commit | |
run: | | |
cd 3rdparty/source/gtest | |
echo "submodule_gtest_commit=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
# 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.bat') }}-${{ hashFiles('3rdparty/premake5.lua') }}-${{ env.submodule_gbench_commit }}-${{ env.submodule_gtest_commit }} | |
- name: Build 3rdparty | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
cd 3rdparty | |
premake5 vs2022 | |
./build.bat | |
- name: Generate build files | |
run: | | |
premake5 vs2022 | |
- name: Build | |
run: | | |
msbuild /m TDiss.sln /t:build /p:Configuration=${{ matrix.config.configuration }} /p:Platform=${{ matrix.config.platform }} | |
- name: Test | |
run: | | |
.\build\${{ matrix.config.output }}\TDissUnitTester.exe --gtest_output=xml:test_results_${{ matrix.config.output }}.xml | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }}-test-results-${{ matrix.config.output }} | |
path: test_results_${{ matrix.config.output }}.xml |