diff --git a/.github/workflows/coverage-build.yml b/.github/workflows/coverage-build.yml new file mode 100644 index 0000000..a72584f --- /dev/null +++ b/.github/workflows/coverage-build.yml @@ -0,0 +1,34 @@ +name: Build Coverage + +on: + pull_request: + branches: + - master + +jobs: + coverage-build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: netkan + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + - name: Install test dependencies + run: pip install .[test] + - name: force our git config + run: cp .gitconfig ~/. + - name: Run Coverage + run: | + coverage run -m pytest + coverage xml + - name: Upload Coverage + uses: actions/upload-artifact@v4 + with: + name: coverage.xml + path: netkan/coverage.xml + retention-days: 1 diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml new file mode 100644 index 0000000..aed4389 --- /dev/null +++ b/.github/workflows/coverage-report.yml @@ -0,0 +1,28 @@ +name: Report Coverage + +on: + workflow_run: + workflows: ["Build Coverage"] + types: + - completed + +permissions: + actions: read + contents: read + pull-requests: write + +jobs: + coverage-report: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - uses: actions/download-artifact@v4 + with: + name: coverage.xml + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Get Cover + uses: techman83/coverage@feat/workflow_run + with: + coverageFile: coverage.xml + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index f6dd7dd..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Coverage - -on: - - pull_request - -permissions: - pull-requests: write - -jobs: - coverage: - if: false - runs-on: ubuntu-latest - defaults: - run: - working-directory: netkan - steps: - - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.11 - - name: Install test dependencies - run: pip install .[test] - - name: force our git config - run: cp .gitconfig ~/. - - name: Run Coverage - run: coverage run -m pytest - - name: Generate report - run: coverage xml - - name: Get Cover - uses: orgoro/coverage@v3 - with: - coverageFile: netkan/coverage.xml - token: ${{ secrets.GITHUB_TOKEN }}