diachenko-mischa is testing out GitHub Actions π #32
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 Demo | |
run-name: ${{ github.actor }} is testing out GitHub Actions π | |
on: [push] | |
jobs: | |
Linter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
cache: 'pip' # caching pip dependencies | |
- uses: ammaraskar/gcc-problem-matcher@master | |
- name: Install PIP packages | |
run: pip install -r requirements.txt | |
- name: Check code formatting | |
run: clang-format -n -Werror `find src -name '*.cpp'` | |
- name: Cmake Configure | |
run: | | |
mkdir build | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
- name: Run clang-tidy (Static analysis & Code style checks) | |
run: clang-tidy -p=build `find src -name '*.cpp'` `find src -name '*.h'` | |
- name: Build | |
run: cmake --build build | |
- name: Run unit tests | |
run: ./build/src/main --gtest_output=xml:gtest_report.xml | |
- name: Generate coverage reports | |
run: | | |
mkdir coverage | |
python3 -m gcovr --filter "src/*" --cobertura cobertura-coverage-details.xml | |
python3 -m gcovr --filter "src/*" --html-details coverage/coverage-details.html | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v4 | |
if: success() || failure() # always run even if the previous step fails | |
with: | |
report_paths: 'gtest_report.xml' | |
include_passed: true | |
- name: Code Coverage Report | |
uses: irongut/[email protected] | |
with: | |
filename: cobertura-coverage-details.xml | |
badge: true | |
fail_below_min: true | |
format: markdown | |
hide_branch_rate: false | |
hide_complexity: true | |
indicators: true | |
output: both | |
thresholds: '60 80' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md | |
- name: Upload gtest report | |
uses: actions/upload-artifact@v3 # upload test results | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: gtest_report | |
path: gtest_report.xml | |
- name: Upload coverage report | |
uses: actions/upload-artifact@v3 # upload test results | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: coverage | |
path: coverage/ |