From 58e50f852bdd5e97fd9b00bc14afb19aa4d03c4c Mon Sep 17 00:00:00 2001 From: trincaog Date: Tue, 2 Jan 2024 18:09:50 +0000 Subject: [PATCH] run tests on push --- .github/workflows/python-publish.yml | 31 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 1a7551e..8b509ce 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -8,27 +8,23 @@ name: Upload Python Package to PyPI -on: - release: - types: [published] - -permissions: - contents: read +on: [push] jobs: deploy: name: Upload release to PyPI runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/magiccube + strategy: + matrix: + python-version: ["3.11"] + steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: ${{ matrix.python-version }} - name: Extract tag name id: tag @@ -47,12 +43,15 @@ jobs: - name: Test with pytest run: | pip install pytest - pytest test/ --doctest-modules --junitxml=junit/test-results.xml + pytest test/ --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml + + - name: Upload pytest test results + uses: actions/upload-artifact@v3 + with: + name: pytest-results-${{ matrix.python-version }} + path: junit/test-results-${{ matrix.python-version }}.xml + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} - name: Build package run: python -m build - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }}