Skip to content

Commit

Permalink
chore: update python test action
Browse files Browse the repository at this point in the history
  • Loading branch information
chizmw committed Mar 24, 2024
1 parent d980adb commit 959fe86
Showing 1 changed file with 18 additions and 39 deletions.
57 changes: 18 additions & 39 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ permissions:
id-token: write

jobs:
build:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']
poetry-version: [1.5.1]
python-version: ['3.10', '3.12']
poetry-version: [1.7.1]

steps:
- uses: actions/checkout@v4
Expand All @@ -35,53 +35,32 @@ jobs:
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Setup a local virtual environment (if no poetry.toml file)
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v4
name: Define a cache for the virtual environment
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}-${{ matrix.python-version }}
- name: Install dependencies
run: |
poetry install
- name: Test with pytest
run: |
make test
mv test-results.xml test-results-${{ matrix.python-version }}.xml
# we want to make test-results.xml an artifact
- name: Archive test results
uses: actions/upload-artifact@v4
with:
name: test-results
path: test-results.xml
name: test-results-${{ matrix.python-version }}
path: test-results-${{ matrix.python-version }}.xml

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
- name: Test Summary
uses: test-summary/action@v2
with:
annotate_notice: true
check_title_template: '{{SUITE_NAME}} {{TEST_NAME}}'
detailed_summary: true
fail_on_failure: true
include_passed: true
report_paths: '**/test-results.xml'
require_tests: true
summary: true

- name: Surface failing tests
paths: '**/test-results-*.xml'
if: always()
uses: pmeier/pytest-results-action@main
with:
# A list of JUnit XML files, directories containing the former, and
# wildcard
# patterns to process.
# See @actions/glob for supported patterns.
path: test-results.xml

# Add a summary of the results at the top of the report
# Default: true
summary: true

# Select which results should be included in the report.
# Follows the same syntax as
# `pytest -r`
# Default: fEX
display-options: fEX

# Fail the workflow if no JUnit XML was found.
# Default: true
fail-on-empty: true

0 comments on commit 959fe86

Please sign in to comment.