From 54d879594c0dc28ab75f16c4a326b50de5543629 Mon Sep 17 00:00:00 2001 From: "Ware, Joseph (DLSLtd,RAL,LSCI)" Date: Mon, 14 Oct 2024 15:46:33 +0100 Subject: [PATCH 1/2] Provide historical summary of tests and PR comment on failed tests --- .github/workflows/_test.yml | 19 ++++++++++++++++++- pyproject.toml | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 37d997af1a..9d90e371d0 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -49,8 +49,9 @@ jobs: with: python-version: ${{ inputs.python-version }} pip-install: ".[dev]" + - name: Run tests - run: tox -e tests + run: tox -e tests -- --ctrf report.json - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 @@ -59,3 +60,19 @@ jobs: files: cov.xml env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + - name: Comment on failing PR tests + run: npx github-actions-ctrf summary report.json --pr-comment --on-fail-only + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish CTRF Historical results table + run: npx github-actions-ctrf historical report.json + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload test results + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.python-version }}-${{ inputs.runs-on }}-ctrf-report + path: report.json diff --git a/pyproject.toml b/pyproject.toml index 7dbf22271b..66f2b291a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,6 +64,7 @@ dev = [ "pytest-forked", "pytest-rerunfailures", "pytest-timeout", + "pytest-json-ctrf", "ruff", "sphinx<7.4.0", # https://github.com/bluesky/ophyd-async/issues/459 "sphinx-autobuild", From e3d5d7e49c0feb6b042cd2dc6230d2c8675289c9 Mon Sep 17 00:00:00 2001 From: "Ware, Joseph (DLSLtd,RAL,LSCI)" Date: Mon, 14 Oct 2024 15:50:00 +0100 Subject: [PATCH 2/2] Publish comments on success --- .github/workflows/_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 9d90e371d0..32a66bb627 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -61,8 +61,8 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - name: Comment on failing PR tests - run: npx github-actions-ctrf summary report.json --pr-comment --on-fail-only + - name: Comment on PR test status + run: npx github-actions-ctrf summary report.json --pr-comment env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}