From 123008aa430e0560f42a5a6942cb29274a4784d3 Mon Sep 17 00:00:00 2001 From: Feeph Aifeimei <55798703+feeph@users.noreply.github.com> Date: Tue, 13 Aug 2024 19:22:03 +0000 Subject: [PATCH] ci: split testing and coverage report into separate actions The coveralls GitHub Action needs to run on push and pull-request, but it doesn't make sense to run the full test-suite on every push since the code has already been testing during the pull-request. -> split coverage report and testing into two separate GitHub Actions --- .github/workflows/coveralls.yaml | 38 ++++++++++++++++++++++++++++ .github/workflows/validate-code.yaml | 10 -------- 2 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/coveralls.yaml diff --git a/.github/workflows/coveralls.yaml b/.github/workflows/coveralls.yaml new file mode 100644 index 0000000..beb8522 --- /dev/null +++ b/.github/workflows/coveralls.yaml @@ -0,0 +1,38 @@ +--- +# +# https://coveralls.io/ +# + +name: update coverage report (coveralls) + +on: + pull_request: + push: + branches: + - main + - master + +jobs: + coverage: + name: generate coverage report + runs-on: ubuntu-latest + steps: + - name: checkout repository + uses: actions/checkout@v4 + - name: configure Python (using PDM) + uses: pdm-project/setup-pdm@v4 + with: + python-version-file: pyproject.toml + - name: install dependencies + run: | + pdm install + - name: generate coverage report + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pdm run coverage run --source=feeph.i2c -m pytest tests/ + pdm run coveralls + mkdir -p coverage + pdm run coverage-lcov --output_file_path=coverage/lcov.info + - name: coveralls action + uses: coverallsapp/github-action@v2 diff --git a/.github/workflows/validate-code.yaml b/.github/workflows/validate-code.yaml index 0be0c1d..099ec8a 100644 --- a/.github/workflows/validate-code.yaml +++ b/.github/workflows/validate-code.yaml @@ -68,16 +68,6 @@ jobs: if [[ -n $CONTRIB_FILES ]] ; then pdm run mypy $CONTRIB_FILES fi - - name: generate coverage report - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - pdm run coverage run --source=feeph.i2c -m pytest tests/ - pdm run coveralls - mkdir -p coverage - pdm run coverage-lcov --output_file_path=coverage/lcov.info - - name: coveralls action - uses: coverallsapp/github-action@v2 test: name: perform unit tests # wait on linting results; makes no sense to test if the code is broken