From 7a132c457078d56d250a0db43853714937afe5a1 Mon Sep 17 00:00:00 2001 From: Michael Skalka Date: Wed, 29 Jan 2025 11:42:55 -0500 Subject: [PATCH 1/2] feat(agent/ci): add unittest reporting to agent MRs --- .github/workflows/agent-ci.yaml | 29 ++++++++++++++++++----------- agent/.gitignore | 1 + agent/Makefile | 4 ++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/agent-ci.yaml b/.github/workflows/agent-ci.yaml index 8b7458c0..f8f02482 100644 --- a/.github/workflows/agent-ci.yaml +++ b/.github/workflows/agent-ci.yaml @@ -1,23 +1,30 @@ name: Agent Unittest on: - pull_request: {} - push: - tags: [ "v/*" ] + pull_request: + paths: + - agent/** 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 and coverage.xml report + - name: Run unittests run: | cd agent - make test \ No newline at end of file + make test + - name: Generate Summary + uses: test-summary/action@v2 + if: always() + with: + paths: "agent/skyhook-agent/test-results.xml" + output: test-summary.md + - name: Display Summary + if: always() + run: | + cat test-summary.md >> $GITHUB_STEP_SUMMARY \ No newline at end of file diff --git a/agent/.gitignore b/agent/.gitignore index 6c3c2943..e77d9a4c 100644 --- a/agent/.gitignore +++ b/agent/.gitignore @@ -8,5 +8,6 @@ dist .coverage .coverage.* coverage.xml +test-results.xml vendor/lock_file.bak \ No newline at end of file diff --git a/agent/Makefile b/agent/Makefile index 310e88b9..5a5cf348 100644 --- a/agent/Makefile +++ b/agent/Makefile @@ -32,9 +32,9 @@ venv: ## Sets up a python venv at `./venv` ##@ Test .PHONY: test test: venv ## Test using hatch, prints coverage and outputs a report to coverage.xml - $(VENV)hatch -p skyhook-agent test --cover-quiet + $(VENV)hatch -p skyhook-agent test --cover-quiet --junit-xml=test-results.xml $(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: From a41dba51c0da11608860f6b64d989ecac7de87bc Mon Sep 17 00:00:00 2001 From: Michael Skalka Date: Wed, 29 Jan 2025 11:48:33 -0500 Subject: [PATCH 2/2] better job title --- .github/workflows/agent-ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/agent-ci.yaml b/.github/workflows/agent-ci.yaml index f8f02482..f9ad6dba 100644 --- a/.github/workflows/agent-ci.yaml +++ b/.github/workflows/agent-ci.yaml @@ -5,7 +5,7 @@ on: - agent/** jobs: test: - name: Run tests & display coverage + name: Skyhook Agent Unit Tests runs-on: ubuntu-latest permissions: contents: read