Fix the github action workflow #6
Workflow file for this run
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
| # main workflow; ported from .travis.yaml | |
| name: main | |
| on: | |
| push: | |
| branches: [ '*', $default-branch ] | |
| tags: 'v*' | |
| pull_request: | |
| branches: [ $default-branch ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| strategy: | |
| matrix: | |
| python-version: ['3.6', '3.10', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y build-essential python3-numpy cython3 | |
| python -m pip install --upgrade pip | |
| pip install build pytest | |
| pip install astropy scipy #For the tests | |
| - name: Build | |
| run: | | |
| python -m build | |
| - name: Install | |
| run: | | |
| python -m pip install --user dist/classylss*whl | |
| - name: Build in place for tests | |
| run: | | |
| python setup.py build_ext --inplace | |
| - name: python unit tests | |
| run: | | |
| cd classylss | |
| python -m pytest | |
| - name: Version | |
| run: bash check_tag.sh classylss/version.py | |
| - name: Store the distribution packages | |
| if: matrix.python-version == '3.10' #Only do this once! | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/classylss*.tar.gz | |
| #From https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ | |
| publish-to-pypi: | |
| name: Publish to PyPI | |
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download the source dist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package-distributions | |
| path: dist/ | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |