python linting and coverage #13
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: najaeda test, coverage and lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
# install dependencies | |
- name: Install boost & capnproto | |
run: sudo apt-get update && sudo apt-get install -yq libboost-dev libfl-dev capnproto libcapnp-dev libtbb-dev | |
- name: Configure CMake | |
# 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: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_SANITIZERS=OFF -DLONG_TESTS=OFF | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest -VV -C ${{env.BUILD_TYPE}} | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.13 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
pip install coverage | |
- name: Lint with flake8 | |
working-directory: ${{github.workspace}}/src/najaeda | |
run: flake8 | |
continue-on-error: true | |
- name: Run najaeda testing with pytest | |
working-directory: ${{github.workspace}}/test/najaeda | |
env: | |
PYTHONPATH: ${{github.workspace}}/build/test/najaeda | |
run: | | |
python -m coverage run -m unittest && python -m coverage xml | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: ${{github.workspace}}/test/najaeda/.coverage.xml | |
report-coverage: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Download tests coverage report | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- name: Report Coverage and annotate PR (if exists) | |
uses: orgoro/coverage@v3 | |
with: | |
coverageFile: .coverage.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
thresholdAll: 0.50 | |
thresholdNew: 0.90 | |
thresholdModified: 0.0 |