Merge pull request #42 from AI-Hypercomputer/lukebaumann-patch-1 #89
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unittests & Auto-publish | ||
| # Allow to trigger the workflow manually (e.g. when deps changes) | ||
| on: [push, workflow_dispatch] | ||
| jobs: | ||
| unittest-job: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| python-version: ['3.10', '3.11', '3.12'] | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }} | ||
| cancel-in-progress: true | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| # Install deps | ||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - run: pip --version | ||
| - run: pip install -e . | ||
| - run: pip freeze | ||
| # Run tests | ||
| - name: Run core tests | ||
| run: python -m unittest discover --pattern "*_test.py" --start-directory "pathwaysutils/test" | ||
| publish-to-testpypi: | ||
| if: ${{inputs.testpypi}} == true | ||
| name: Publish Python distribution to TestPyPI | ||
| needs: | ||
| - build | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: testpypi | ||
| url: https://test.pypi.org/p/pathwaysutils | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download all the dists | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: python-package-distributions | ||
| path: dist/ | ||
| - name: Publish distribution 📦 to TestPyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| repository-url: https://test.pypi.org/legacy/ | ||
| verbose: true | ||
| publish-to-pypi: | ||
| name: Publish Python distribution to PyPI | ||
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
| needs: unittest-job # Only publish after tests are successful | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#configuring-trusted-publishing | ||
| name: pypi | ||
| url: https://pypi.org/p/pathwaysutils # Replace <package-name> with your PyPI project name | ||
| permissions: | ||
| id-token: write # IMPORTANT: mandatory for trusted publishing | ||