2023-12-06 17:43:39 -05:00
|
|
|
name: CMake
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
|
|
ci-cmake:
|
|
|
|
name: ${{ matrix.name }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- name: Ubuntu GCC
|
|
|
|
os: ubuntu-latest
|
|
|
|
compiler: gcc
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
|
|
|
|
# Test out of source builds
|
|
|
|
- name: Ubuntu GCC OSB
|
|
|
|
os: ubuntu-latest
|
|
|
|
compiler: gcc
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
build-dir: ../build
|
|
|
|
src-dir: ../zlib
|
|
|
|
|
|
|
|
- name: Ubuntu GCC -O3
|
|
|
|
os: ubuntu-latest
|
|
|
|
compiler: gcc
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -O3 -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
|
|
|
|
- name: Ubuntu Clang
|
|
|
|
os: ubuntu-latest
|
|
|
|
compiler: clang
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
|
|
|
|
- name: Ubuntu Clang Debug
|
|
|
|
os: ubuntu-latest
|
|
|
|
compiler: clang
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
build-config: Debug
|
|
|
|
|
|
|
|
- name: Windows MSVC Win32
|
|
|
|
os: windows-latest
|
|
|
|
compiler: cl
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: /WX /W3
|
2023-12-06 17:43:39 -05:00
|
|
|
cmake-args: -A Win32
|
|
|
|
|
|
|
|
- name: Windows MSVC Win64
|
|
|
|
os: windows-latest
|
|
|
|
compiler: cl
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: /WX /W3
|
2023-12-06 17:43:39 -05:00
|
|
|
cmake-args: -A x64
|
|
|
|
|
|
|
|
- name: Windows GCC
|
|
|
|
os: windows-latest
|
|
|
|
compiler: gcc
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
cmake-args: -G Ninja
|
|
|
|
|
|
|
|
- name: macOS Clang
|
|
|
|
os: macos-latest
|
|
|
|
compiler: clang
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
|
|
|
|
- name: macOS GCC
|
|
|
|
os: macos-latest
|
|
|
|
compiler: gcc-11
|
2024-06-17 19:04:36 -04:00
|
|
|
cflags: -Werror -Wall -Wextra
|
2023-12-06 17:43:39 -05:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2024-06-17 19:04:36 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-12-06 17:43:39 -05:00
|
|
|
|
|
|
|
- name: Install packages (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
choco install --no-progress ninja ${{ matrix.packages }}
|
|
|
|
|
|
|
|
- name: Generate project files
|
|
|
|
run: cmake -S ${{ matrix.src-dir || '.' }} -B ${{ matrix.build-dir || '.' }} ${{ matrix.cmake-args }} -D CMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }}
|
|
|
|
env:
|
|
|
|
CC: ${{ matrix.compiler }}
|
|
|
|
CFLAGS: ${{ matrix.cflags }}
|
|
|
|
|
|
|
|
- name: Compile source code
|
|
|
|
run: cmake --build ${{ matrix.build-dir || '.' }} --config ${{ matrix.build-config || 'Release' }}
|
|
|
|
|
|
|
|
- name: Run test cases
|
|
|
|
run: ctest -C Release --output-on-failure --max-width 120
|
|
|
|
working-directory: ${{ matrix.build-dir || '.' }}
|
|
|
|
|
|
|
|
- name: Upload build errors
|
2024-06-17 19:04:36 -04:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-12-06 17:43:39 -05:00
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.name }} (cmake)
|
|
|
|
path: |
|
|
|
|
**/CMakeFiles/CMakeOutput.log
|
|
|
|
**/CMakeFiles/CMakeError.log
|
|
|
|
retention-days: 7
|