diff --git a/.github/workflows/agent-ci.yaml b/.github/workflows/agent-ci.yaml index a5972e8f..4dce4ed1 100644 --- a/.github/workflows/agent-ci.yaml +++ b/.github/workflows/agent-ci.yaml @@ -1,38 +1,23 @@ name: Agent Unittest -on: - pull_request: {} - push: - tags: [ "v/*" ] +on: [ "pull_request" ] jobs: test: name: Run tests & display coverage runs-on: ubuntu-latest permissions: - # Gives the action the necessary permissions for publishing new - # comments in pull requests. + contents: read + issues: read + checks: write pull-requests: write - # Gives the action the necessary permissions for pushing data to the - # python-coverage-comment-action branch, and for editing existing - # comments (to avoid publishing multiple comments in the same PR) - contents: write steps: - uses: actions/checkout@v4 - - name: Install everything, run the tests, produce the .coverage file run: | cd agent make test - - name: Coverage comment - id: coverage_comment - uses: py-cov-action/python-coverage-comment-action@v3 + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() with: - COVERAGE_PATH: agent/ - GITHUB_TOKEN: ${{ github.token }} - - name: Store Pull Request comment to be posted - uses: actions/upload-artifact@v4 - if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' - with: - # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly - name: python-coverage-comment-action - # If you use a different name, update COMMENT_FILENAME accordingly - path: python-coverage-comment-action.txt \ No newline at end of file + files: | + agent/coverage.xml \ No newline at end of file diff --git a/.github/workflows/agent-coverage.yaml b/.github/workflows/agent-coverage.yaml deleted file mode 100644 index 67c22589..00000000 --- a/.github/workflows/agent-coverage.yaml +++ /dev/null @@ -1,21 +0,0 @@ -name: Post coverage comment -on: - workflow_run: - workflows: ["Agent Unittest"] - types: - - completed -jobs: - test: - name: Run tests & display coverage - runs-on: ubuntu-latest - if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' - permissions: - pull-requests: write - contents: write - actions: read - steps: - - name: Post comment - uses: py-cov-action/python-coverage-comment-action@v3 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }} \ No newline at end of file diff --git a/agent/Makefile b/agent/Makefile index 9463e15a..b341043f 100644 --- a/agent/Makefile +++ b/agent/Makefile @@ -34,7 +34,7 @@ venv: ## Sets up a python venv at `./venv` test: venv ## Test using hatch, prints coverage and outputs a report to coverage.xml $(VENV)hatch -p skyhook-agent test --cover-quiet $(VENV)coverage report --show-missing --data-file=skyhook-agent/.coverage -## $(VENV)coverage xml --data-file=skyhook-agent/.coverage + $(VENV)coverage xml --data-file=skyhook-agent/.coverage .PHONY: format format: diff --git a/foo b/foo new file mode 100644 index 00000000..e69de29b