update test workflows and related codes. #8
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: Build MinGW | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
jobs: | |
build-mingw: | |
if: >- | |
! contains(toJSON(github.event.commits.*.message), '[skip ci]') && | |
! contains(toJSON(github.event.commits.*.message), '[skip github]') | |
runs-on: ${{matrix.os}} | |
defaults: | |
run: | |
shell: msys2 {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ windows-latest ] | |
build_type: [ Release ] | |
config: | |
- msystem: "MINGW64" | |
install: >- | |
git mingw-w64-x86_64-cmake | |
mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-ninja | |
name: "On ${{matrix.os}} ${{matrix.config.msystem}} ${{matrix.build_type}}" | |
env: | |
CMAKE_GENERATOR: 'Ninja' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
msystem: ${{matrix.config.msystem}} | |
install: ${{matrix.config.install}} | |
- name: Set output | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Configure | |
run: >- | |
cmake -B "${{ steps.strings.outputs.build-output-dir }}" | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-S "${{ github.workspace }}" | |
- name: Build | |
run: >- | |
cmake --build "${{ steps.strings.outputs.build-output-dir }}" | |
--config ${{ matrix.build_type }} | |
- name: Test | |
working-directory: "${{ steps.strings.outputs.build-output-dir }}" | |
run: ctest --output-on-failure --build-config ${{ matrix.build_type }} |