-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GH Actions: Build and test using cmake
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# This workflow is for CMake-based build/test running on multiple platforms. | ||
name: cmake build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.os }} ${{ matrix.c_compiler }} ${{ matrix.build_type }} thr:${{ matrix.enable_threads }} dll:${{ matrix.shared_libs }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
# Deliver the feedback for all matrix combinations. | ||
fail-fast: false | ||
|
||
matrix: | ||
os: [ macos-latest, ubuntu-latest, windows-latest ] | ||
c_compiler: [ cl, clang, gcc ] | ||
build_type: [ Debug, Release ] | ||
gc_assertions: [ off, on ] | ||
enable_threads: [ off, on ] | ||
shared_libs: [ off, on ] | ||
exclude: | ||
- os: macos-latest | ||
c_compiler: cl | ||
- os: macos-latest | ||
c_compiler: gcc | ||
- os: ubuntu-latest | ||
c_compiler: cl | ||
- build_type: Debug | ||
gc_assertions: off | ||
- build_type: Release | ||
gc_assertions: on | ||
- os: windows-latest # TODO: support dependency on libatomic_ops | ||
c_compiler: cl | ||
enable_threads: on | ||
include: | ||
- os: windows-latest | ||
c_compiler: gcc | ||
cmake_generator_opt: '-G "Unix Makefiles"' | ||
- os: windows-latest | ||
c_compiler: clang | ||
cmake_generator_opt: '-G "Unix Makefiles"' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set reusable strings | ||
# Turn repeated input strings into step outputs. | ||
id: strings | ||
shell: bash | ||
run: | | ||
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | ||
- name: Configure CMake | ||
# Configure CMake in a 'build' subdirectory. | ||
run: > | ||
cmake -B ${{ steps.strings.outputs.build-output-dir }} | ||
${{ matrix.cmake_generator_opt }} | ||
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} | ||
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | ||
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | ||
-Dbuild_tests=ON | ||
-Denable_gc_assertions=${{ matrix.gc_assertions }} | ||
-Denable_threads=${{ matrix.enable_threads }} | ||
-Denable_werror=ON | ||
-Werror=dev | ||
-S ${{ github.workspace }} | ||
- name: Build | ||
# Build the code with the given configuration. | ||
run: > | ||
cmake --build ${{ steps.strings.outputs.build-output-dir }} | ||
--config ${{ matrix.build_type }} --verbose --parallel | ||
- name: Test | ||
working-directory: ${{ steps.strings.outputs.build-output-dir }} | ||
# Execute tests defined by the CMake configuration. | ||
run: ctest --build-config ${{ matrix.build_type }} --verbose --parallel 8 |