Update build-matrix.yml #171
Workflow file for this run
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: CMake Build Matrix | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
include: | |
- os: windows-latest | |
compiler: msvc | |
- os: ubuntu-latest | |
compiler: gcc-linux | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Install GCC 13.1 | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | |
sudo apt-get update | |
sudo apt-get install -y gcc-13 g++-13 | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 60 | |
- name: vcpkg installation | |
shell: bash | |
run: | | |
git clone https://github.com/microsoft/vcpkg.git | |
cd vcpkg | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
./bootstrap-vcpkg.bat | |
else | |
./bootstrap-vcpkg.sh | |
fi | |
./vcpkg integrate install | |
./vcpkg install | |
- name: Cache vcpkg packages | |
uses: actions/[email protected] | |
with: | |
path: | | |
${{ github.workspace }}/vcpkg/installed | |
${{ github.workspace }}/vcpkg/vcpkg | |
key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg.json') }} | |
restore-keys: | | |
${{ runner.os }}-vcpkg- | |
- name: Configure CMake | |
run: | | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake | |
- name: Build | |
run: | | |
cmake --build build --config Release | |
- name: List contents of output directory | |
run: | | |
echo "Contents of output directory:" | |
ls -R ${{ github.workspace }}/output/bin/release | |
# run tests for Linux | |
- name: Run tests on Linux | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
for test_exe in ${{ github.workspace }}/build/*_tests; do | |
echo "Running $test_exe" | |
"$test_exe" | |
done | |
# run tests for Windows | |
- name: Run tests on Windows | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Get-ChildItem -Path "${{ github.workspace }}\build\*_tests.exe" | ForEach-Object { | |
echo "Running $($_.FullName)" | |
& $_.FullName | |
} | |