Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
szhorvat committed Nov 18, 2024
1 parent a6eae85 commit a72660f
Showing 1 changed file with 19 additions and 54 deletions.
73 changes: 19 additions & 54 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,38 @@ on: [push, pull_request]

jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.os }} ${{ matrix.shared_libs && 'shared' || 'static' }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows static",
os: windows-latest,
build_type: "Release",
shared_libs: false,
generators: "Visual Studio 17 2022"
}
- {
name: "Ubuntu Linux static",
os: ubuntu-latest,
build_type: "Release",
shared_libs: false,
generators: "Ninja"
}
- {
name: "macOS static",
os: macos-latest,
build_type: "Release",
shared_libs: false,
generators: "Ninja"
}
- {
name: "Windows shared",
os: windows-latest,
build_type: "Release",
shared_libs: true,
generators: "Visual Studio 17 2022"
}
- {
name: "Ubuntu Linux shared",
os: ubuntu-latest,
build_type: "Release",
shared_libs: true,
generators: "Ninja"
}
- {
name: "macOS shared",
os: macos-latest,
build_type: "Release",
shared_libs: true,
generators: "Ninja"
}
os: [windows-latest, ubuntu-latest, macos-latest]
build_type: ["Release"]
shared_libs: [false, true]
exclude:
- os: windows-latest
generator: Ninja # Windows doesn't use Ninja
generator:
- windows-latest: "Visual Studio 17 2022"

steps:
- uses: actions/checkout@v4

- name: Install dependencies on Windows
if: startsWith(matrix.config.os, 'windows')
if: startsWith(matrix.os, 'windows')
run: choco install -y --no-progress cmake ninja

- name: Install dependencies on Linux
if: startsWith(matrix.config.os, 'ubuntu')
if: startsWith(matrix.os, 'ubuntu')
run: |
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
sudo apt-get install ninja-build cmake
- name: Install dependencies on macOS
if: startsWith(matrix.config.os, 'macos')
if: startsWith(matrix.os, 'macos')
run: brew install cmake ninja

- name: Prepare build folder
Expand All @@ -80,14 +45,14 @@ jobs:
cmake \
-S . \
-B build \
-DBUILD_SHARED_LIBS=${{ matrix.config.shared_libs }} \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
-G "${{ matrix.config.generators }}" \
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{ matrix.generator }}" \
-DCMAKE_INSTALL_PREFIX:PATH=instdir
- name: Build project
shell: bash
run: cmake --build build --config ${{ matrix.config.build_type }}
run: cmake --build build --config ${{ matrix.build_type }}

- name: Run tests
shell: bash
Expand All @@ -101,9 +66,9 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-results-${{ matrix.config.os }}-${{ matrix.config.shared_libs }}
name: unit-test-results-${{ matrix.os }}-${{ matrix.shared_libs }}
path: build/report.xml

- name: Install and strip
shell: bash
run: cmake --install build --config ${{ matrix.config.build_type }} --strip
run: cmake --install build --config ${{ matrix.build_type }} --strip

0 comments on commit a72660f

Please sign in to comment.