Merge pull request #278 from NoxHarmonium/cpp-refactoring #117
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: SIRC Tiledit | |
# TODO: Only run when sirc-tiledit directory has changes | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
defaults: | |
run: | |
working-directory: ./sirc-tiledit | |
jobs: | |
build: | |
name: Quality Checks | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/noxharmonium/sirc-tiledit-build:main | |
options: --user root | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set ownership | |
run: | | |
# Workaround for https://github.com/actions/runner/issues/2033 | |
chown -R $(id -u):$(id -g) $PWD | |
git config --global --add safe.directory /__w/sirc/sirc | |
- name: Configure Project | |
run: | | |
meson --version | |
meson setup -Db_coverage=true --buildtype debug build-debug/ | |
- name: Compile Project (Debug) | |
run: | | |
cd build-debug | |
meson compile -v | |
- name: Test Project | |
run: | | |
cd build-debug | |
meson test --print-errorlogs | |
ninja coverage-xml | |
- name: Archive test coverage | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: codecov-tiledit | |
path: | | |
./sirc-tiledit/build-debug/meson-logs/coverage.xml | |
./sirc-tiledit/libs/shared/tests/resources/*actual*.png | |
if-no-files-found: error | |
- name: Lint Project | |
run: | | |
cd build-debug | |
clang-tidy --version | |
ninja clang-tidy | |
clang-format --version | |
ninja clang-format-check | |
build-release: | |
name: Build Release | |
runs-on: ubuntu-latest | |
needs: [build] | |
container: | |
image: ghcr.io/noxharmonium/sirc-tiledit-build:main | |
options: --user root | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set ownership | |
run: | | |
# Workaround for https://github.com/actions/runner/issues/2033 | |
chown -R $(id -u):$(id -g) $PWD | |
git config --global --add safe.directory /__w/sirc/sirc | |
- name: Configure Project | |
run: | | |
meson --version | |
meson setup --buildtype release build-release/ -Db_lto=true | |
- name: Compile Project (Release) | |
run: | | |
cd build-release | |
meson compile -v | |
# The results won't be very useful but it will ensure the benchmarks still compile and run | |
- name: Run Benchmark (Release) | |
run: | | |
cd build-release | |
ninja benchmark | |
- name: Create release | |
run: | | |
cd build-release | |
meson dist | |
- name: Archive release | |
if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build artifacts | |
path: ./sirc-tiledit/build-release/meson-dist/* | |
if-no-files-found: error | |
upload-to-codecov: | |
name: Upload Coverage | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: codecov-tiledit | |
- name: List artifacts | |
run: ls -la | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
files: coverage.xml | |
fail_ci_if_error: true |