Merge pull request #416 from na-trium-144/fix-ci-mac12 #250
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
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. | |
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml | |
name: Meson Test and Output Coverage (Linux GCC) | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
test: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build | |
sudo apt-get install -y lcov | |
sudo apt-get install -y libspdlog-dev libjpeg-dev libpng-dev libwebp-dev | |
- name: Install meson | |
run: pip install meson || pip install --break-system-packages meson | |
- name: Setup Meson | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: > | |
meson setup build | |
--buildtype=debug | |
-Dtest_wait=200 | |
-Db_coverage=true | |
- name: Compile | |
run: meson compile -C build | |
- name: Test | |
run: meson test -C build -v | |
- name: Get coverage | |
id: coverage | |
run: | | |
ninja coverage -C build | |
COVERAGE=$(ninja coverage -C build | grep -A 1 Overall | grep lines | awk '{print $2}') | |
echo "##[set-output name=lines;]${COVERAGE}" | |
- uses: actions/checkout@v3 | |
with: | |
ref: badge | |
path: badge | |
- name: Generate the badge SVG image | |
uses: emibcn/badge-action@v2.0.2 | |
with: | |
label: 'Test coverage' | |
status: ${{ steps.coverage.outputs.lines }} | |
color: 'blue' | |
path: badge/coverage.svg | |
- name: Commit badge | |
working-directory: ${{github.workspace}}/badge | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add coverage.svg | |
git commit -m "Add/Update badge" || true | |
- name: Push badge commit | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: badge | |
directory: badge |