diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml index 76dd9b1..9b5d7be 100644 --- a/.github/workflows/pr-comment.yaml +++ b/.github/workflows/pr-comment.yaml @@ -1,20 +1,33 @@ -name: Comment on PR +name: Report test coverage on PR on: pull_request: branches: [ "main" ] jobs: - comment: + comment-test-coverage: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v5 + - name: Test + id: test + run: | + echo "coverage<> $GITHUB_OUTPUT + make test-gha >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - uses: actions/github-script@v7 + env: + INPUT_COVERAGE: ${{ steps.test.outputs.coverage }} with: - github-token: ${{secrets.GHA_PRS}} + github-token: ${{ secrets.GHA_PRS }} script: | github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: '👋 Thanks for reporting!' + body: '```' + core.getInput('coverage') + '```' }) diff --git a/Makefile b/Makefile index e81b8e3..741b1ac 100644 --- a/Makefile +++ b/Makefile @@ -9,3 +9,7 @@ test-report-mac: .PHONY: test-report-win test-report-win: start htmlcov/index.html + +.PHONY: test-gha +test-gha: + uv run pytest --cov-report=term -r f -s diff --git a/src/main.py b/src/main.py index 3979400..8fd1cd1 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,5 @@ def main(): - print("Hello from python-template!") + print("Hello from python-basic-template!") if __name__ == "__main__":