Add test source to CMakeLists.txt #13
Workflow file for this run
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: GitHub Actions Build | |
on: [push, pull_request] | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
name: ${{ matrix.platform.name }} | |
runs-on: ${{ matrix.platform.os }} | |
defaults: | |
run: | |
shell: ${{ matrix.platform.shell }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- { name: Windows-mingw64, os: windows-latest, artifact: 'ags-mingw64', shell: 'msys2 {0}', runbin: "./ags", bindir: "", msystem: mingw64, msys-env: mingw-w64-x86_64 } | |
- { name: Windows, os: windows-latest, artifact: 'ags-windows', shell: cmd, runbin: ".\\ags.exe", bindir: "Release" } | |
- { name: Ubuntu, os: ubuntu-latest, artifact: 'ags-linux', shell: sh, runbin: "./ags", bindir: "" } | |
- { name: macOS, os: macos-latest, artifact: 'ags-macos', shell: sh, runbin: "./ags", bindir: "" } | |
steps: | |
- name: Set up MSYS2 | |
if: matrix.platform.shell == 'msys2 {0}' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.platform.msystem }} | |
install: >- | |
${{ matrix.platform.msys-env }}-cc | |
${{ matrix.platform.msys-env }}-cmake | |
${{ matrix.platform.msys-env }}-ninja | |
${{ matrix.platform.msys-env }}-perl | |
${{ matrix.platform.msys-env }}-python-pip | |
${{ matrix.platform.msys-env }}-pkg-config | |
${{ matrix.platform.msys-env }}-clang-tools-extra | |
- name: Set up Tappy | |
run: pip install tap.py | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: | | |
cmake --version | |
cmake -S "${{github.workspace}}" -B "${{github.workspace}}/build" -DAGS_BUILD_TOOLS=1 -DAGS_TESTS=1 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
run: cmake --build "${{github.workspace}}/build" --config ${{env.BUILD_TYPE}} --parallel 2 | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform.artifact }} | |
path: | | |
${{github.workspace}}/build/${{env.BUILD_TYPE}}/ags.exe | |
${{github.workspace}}/build/ags | |
${{github.workspace}}/build/ags.exe | |
- name: Run game auto-test | |
working-directory: ${{github.workspace}}/build/${{matrix.platform.bindir}} | |
run: | | |
curl -sLo auto-test.ags https://github.com/adventuregamestudio/ags-test-games/releases/latest/download/ags4-auto-test.ags | |
${{matrix.platform.runbin}} --no-message-box --log-stdout=script:info,main:info --user-data-dir . auto-test.ags | |
- name: Check auto-test # we are using tap.py so that the pipeline fails if a test fails | |
working-directory: ${{github.workspace}}/build/${{matrix.platform.bindir}} | |
run: | | |
tappy agstest.tap |