From 6b05290640b12db365b267a7f49c730aedb48abf Mon Sep 17 00:00:00 2001 From: Mike Gerber Date: Fri, 4 Aug 2023 18:28:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20GitHub=20Actions:=20Test=20on=20?= =?UTF-8?q?multiple=20Python=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e3f64c..3d4b637 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,20 @@ on: jobs: test: runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [ "3.6", "3.7", "3.8", "3.9", "3.10", "3.11" ] + + env: + test_results_dir: test-results-${{ matrix.python-version }} + steps: + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Checkout uses: actions/checkout@v3 @@ -26,19 +39,19 @@ jobs: - name: Test run: | cd src - mkdir -p ../test-results - python3 -m pytest --junitxml=../test-results/junit.xml -o junit_family=legacy + mkdir -p ../$test_results_dir + python3 -m pytest --junitxml=../$test_results_dir/junit.xml -o junit_family=legacy - name: Upload test results uses: actions/upload-artifact@v3 if: success() || failure() with: - name: test-results - path: test-results + name: ${{ env.test_results_dir }} + path: ${{ env.test_results_dir }} - name: Report tests uses: dorny/test-reporter@v1 if: success() || failure() with: - name: Tests - path: 'test-results/junit.xml' + name: Results on Python ${{ matrix.python-version }} + path: "${{env.test_results_dir }}/junit.xml" reporter: java-junit