Upgrade cmake.yml #168
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 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ${{matrix.platform.os}} | |
defaults: | |
run: | |
shell: ${{ matrix.platform.shell }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- { name: macOS, os: macos-latest, shell: sh } | |
- { name: Ubuntu, os: ubuntu-latest, shell: sh } | |
- { name: Windows - mingw32, os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 } | |
- { name: Windows - mingw64, os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 } | |
build-type: [Release] | |
build-static: [ON] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup GNU/Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install \ | |
libssl-dev ninja-build zlib1g-dev | |
- name: Setup macOS dependencies | |
if: runner.os == 'macOS' | |
run: | | |
brew install \ | |
ninja zlib | |
echo "CMAKE_PREFIX_PATH=$(brew --prefix openssl):$(brew --prefix zlib)" >> $GITHUB_ENV | |
- name: Setup Windows dependencies | |
if: runner.os == 'Windows' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.platform.msystem}} | |
install: >- | |
${{matrix.platform.msys-env}}-gcc | |
${{matrix.platform.msys-env}}-cmake | |
${{matrix.platform.msys-env}}-ninja | |
${{matrix.platform.msys-env}}-openssl | |
${{matrix.platform.msys-env}}-zlib | |
- name: Configure CMake | |
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -DBUILD_STATIC=${{matrix.build-static}} -DBUILD_TESTING=ON | |
- name: Build | |
run: cmake --build build | |
- name: Test | |
run: ctest --test-dir build --output-on-failure | |
- name: Install | |
run: cmake --install build --strip --prefix install | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unshield-${{github.sha}} (${{matrix.platform.name}}) | |
path: install | |
if-no-files-found: error |