Use the Visual Studio generator in workflows (#5) #86
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: CI | |
on: push | |
env: | |
cpm-path: .cpm | |
cpm-key: zlib-1.3.1-cpm | |
jobs: | |
build: | |
name: ${{ matrix.preset }}-${{ matrix.config }}-${{ matrix.sanitize }} | |
strategy: | |
fail-fast: false | |
matrix: | |
preset: [linux-clang, linux-gcc, macos, windows] | |
config: [Debug, Release] | |
sanitize: [address, thread, undefined, leak, memory] | |
exclude: | |
- { preset: linux-gcc, sanitize: memory } | |
- { preset: macos, sanitize: leak } | |
- { preset: macos, sanitize: memory } | |
- { preset: windows, sanitize: thread } | |
- { preset: windows, sanitize: undefined } | |
- { preset: windows, sanitize: leak } | |
- { preset: windows, sanitize: memory } | |
include: | |
- { preset: linux-clang, os: ubuntu-latest } | |
- { preset: linux-gcc, os: ubuntu-latest } | |
- { preset: macos, os: macos-latest } | |
- { preset: windows, os: windows-latest } | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.cpm-path }} | |
key: ${{ env.cpm-key }} | |
enableCrossOsArchive: true | |
- name: Install dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build | |
- name: Configure | |
run: > | |
cmake --preset ${{ matrix.preset }} | |
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO | |
-DCPM_SOURCE_CACHE="${{ env.cpm-path }}" | |
-DZLIB_SANITIZE=${{ matrix.sanitize }} | |
-DZLIB_VERBOSE=ON | |
- name: Build | |
run: cmake --build --preset ${{ matrix.preset }} --config ${{ matrix.config }} | |
- name: Test | |
run: ctest --preset ${{ matrix.preset }} -C ${{ matrix.config }} | |
- name: Install | |
run: cmake --build --preset ${{ matrix.preset }} --config ${{ matrix.config }} -t install | |
build-mobile: | |
name: ${{ matrix.preset }}-${{ matrix.config }} | |
strategy: | |
fail-fast: false | |
matrix: | |
preset: [android, ios] | |
config: [Debug, Release] | |
include: | |
- { preset: android, os: ubuntu-latest } | |
- { preset: ios, os: macos-latest } | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.cpm-path }} | |
key: ${{ env.cpm-key }} | |
enableCrossOsArchive: true | |
- name: Install dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build | |
- name: Configure | |
run: > | |
cmake --preset ${{ matrix.preset }} | |
-DCPM_SOURCE_CACHE=${{ env.cpm-path }} | |
-DZLIB_VERBOSE=ON | |
- name: Build | |
run: cmake --build --preset ${{ matrix.preset }} --config ${{ matrix.config }} | |
- name: Install | |
run: cmake --build --preset ${{ matrix.preset }} --config ${{ matrix.config }} -t install | |
build-bsd: | |
name: ${{ matrix.preset }}-${{ matrix.arch }}-${{ matrix.config }} | |
strategy: | |
fail-fast: false | |
matrix: | |
preset: [freebsd, netbsd, openbsd] | |
arch: [arm64, x86_64] | |
config: [Debug, Release] | |
exclude: | |
- { preset: netbsd, arch: arm64 } | |
include: | |
- preset: freebsd | |
version: "14.0" | |
install: sudo pkg install -y cmake ninja | |
- preset: netbsd | |
version: "9.3" | |
install: sudo pkgin -y install cmake ninja-build gcc13 | |
- preset: openbsd | |
version: "7.4" | |
install: sudo pkg_add cmake ninja | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.cpm-path }} | |
key: ${{ env.cpm-key }} | |
enableCrossOsArchive: true | |
- uses: cross-platform-actions/action@master | |
with: | |
operating_system: ${{ matrix.preset }} | |
architecture: ${{ matrix.arch }} | |
version: ${{ matrix.version }} | |
run: | | |
${{ matrix.install }} | |
cmake -B build -G Ninja \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} \ | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install \ | |
-DCPM_SOURCE_CACHE=${{ env.cpm-path }} \ | |
-DZLIB_INSTALL=ON \ | |
-DZLIB_TEST=ON \ | |
-DZLIB_VERBOSE=ON | |
cmake --build build | |
cd build | |
ctest -V -C ${{ matrix.config }} | |
cd .. | |
cmake --install build | |
build-msys2: | |
name: msys2-${{ matrix.preset }}-${{ matrix.config }} | |
strategy: | |
fail-fast: false | |
matrix: | |
preset: [UCRT64, CLANG64, CLANG32, MINGW64, MINGW32] | |
config: [Debug, Release] | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.cpm-path }} | |
key: ${{ env.cpm-key }} | |
enableCrossOsArchive: true | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.preset }} | |
update: true | |
pacboy: >- | |
cmake:p | |
gcc:p | |
ninja:p | |
- name: Configure | |
run: > | |
cmake -B build -G Ninja | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install | |
-DCPM_SOURCE_CACHE=${{ env.cpm-path }} | |
-DZLIB_INSTALL=ON | |
-DZLIB_TEST=ON | |
-DZLIB_VERBOSE=ON | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
working-directory: build | |
run: ctest -V -C ${{ matrix.config }} | |
- name: Install | |
run: cmake --install build | |
build-cygwin: | |
name: cygwin-${{ matrix.config }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: [Debug, Release] | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: C:\cygwin\bin\bash.exe --noprofile --norc -o igncr -eo pipefail '{0}' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cygwin/cygwin-install-action@v4 | |
with: | |
packages: cmake gcc-core ninja | |
- name: Configure | |
run: > | |
cmake -B build -G Ninja | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install | |
-DCPM_SOURCE_CACHE=${{ env.cpm-path }} | |
-DZLIB_INSTALL=ON | |
-DZLIB_TEST=ON | |
-DZLIB_VERBOSE=ON | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
working-directory: build | |
run: ctest -V -C ${{ matrix.config }} | |
- name: Install | |
run: cmake --install build |