Skip to content

CI

CI #130

Workflow file for this run

name: CI
on:
push:
workflow_dispatch:
schedule:
- cron: 55 19 * * 5 # 19:55 every friday
jobs:
job:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
preset: windows
- os: ubuntu-latest
preset: unix
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: GCC version on Linux
shell: bash
run: g++ --version
if: runner.os == 'Linux'
- name: Set C++ VCPKG_ROOT
shell: bash
run: echo VCPKG_ROOT="$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV"; cat "$GITHUB_ENV"
# Debug build
- name: Run CMake Debug with manifest mode vcpkg
shell: bash
run: cmake --preset=${{ matrix.preset }} -B build_debug -DTetrisEngine_Test=1 -DUSE_WIX_GENERATOR=1 -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=1 -DCODE_COVERAGE=1
- name: Compile Debug binaries
shell: bash
run: cmake --build build_debug --config Debug
- name: Run Debug tests
shell: bash
run: |
ctest --rerun-failed --output-on-failure --test-dir build_debug/TetrisEngine/TetrisEngine_Test/
ctest --rerun-failed --output-on-failure --test-dir build_debug/App_Test/
- name: Display help text for Debug TetrisEngine
shell: bash
run: ./build_debug/TetrisEngine/TetrisEngine --help
if: runner.os == 'Linux'
- name: Display help text for Debug TetrisEngine
shell: bash
run: ./build_debug/TetrisEngine/Debug/TetrisEngine --help
if: runner.os == 'Windows'
- name: Run Debug TetrisEngine and print every move
shell: bash
run: ./build_debug/TetrisEngine/TetrisEngine -p
if: runner.os == 'Linux'
- name: Run Debug TetrisEngine and print every move
shell: bash
run: ./build_debug/TetrisEngine/Debug/TetrisEngine -p
if: runner.os == 'Windows'
# Test code coverage
- name: Run code coverage
shell: bash
run: |
sudo apt-get install lcov
cd build_debug
lcov -c -d ./App_Lib -d ./TetrisEngine/ -b ../App_Test/src/ -b ../App_Lib/src/ -b ../TetrisEngine/srcLib/ --no-external -o lcov.info
ls -ltr
if: runner.os == 'Linux'
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: build_debug
files: lcov.info
if: runner.os == 'Linux'
# Release build all
- name: Run CMake Release with manifest mode vcpkg
shell: bash
run: cmake --preset=${{ matrix.preset }} -B build_release -DTetrisEngine_Test=1 -DUSE_WIX_GENERATOR=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1
- name: Compile Release binaries
shell: bash
run: cmake --build build_release --config Release
- name: Run Release tests
shell: bash
run: |
ctest --rerun-failed --output-on-failure --test-dir build_release/TetrisEngine/TetrisEngine_Test/
ctest --rerun-failed --output-on-failure --test-dir build_release/App_Test/
- name: Display help text for Release TetrisEngine
shell: bash
run: ./build_release/TetrisEngine/TetrisEngine --help
if: runner.os == 'Linux'
- name: Display help text for Release TetrisEngine
shell: bash
run: ./build_release/TetrisEngine/Release/TetrisEngine --help
if: runner.os == 'Windows'
- name: Run Release TetrisEngine and print every move
shell: bash
run: ./build_release/TetrisEngine/TetrisEngine -p
if: runner.os == 'Linux'
- name: Run Release TetrisEngine and print every move
shell: bash
run: ./build_release/TetrisEngine/Release/TetrisEngine -p
if: runner.os == 'Windows'
# Release build network only (just to make sure it compiles)
- name: Run CMake Release with manifest mode vcpkg
shell: bash
run: cmake --preset=${{ matrix.preset }}-game-server-only -B build_release_server -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1
# Create installer
- name: Run cpack
shell: bash
run: cd build_release && cpack
- name: Extract msi output
shell: bash
run: echo "msi_output=$(ls -1 build_release | grep '.msi$')" >> $GITHUB_ENV
if: runner.os == 'Windows'
- name: Upload installer artifact
uses: actions/upload-artifact@v4
if: runner.os == 'Windows' && env.msi_output != ''
with:
name: installer
path: build_release/${{ env.msi_output }}