chore: avoid triggering build workflow twice #59
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: build | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| - "ci-*" | |
| tags: | |
| - "**" | |
| pull_request: | |
| env: | |
| PY_COLORS: 1 | |
| jobs: | |
| tests-py: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python: | |
| - "3.9" | |
| - "3.10" | |
| - "3.11" | |
| - "pypy-3.10" | |
| - "pypy-3.11" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Python ${{ matrix.python }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install dependencies | |
| run: pip install tox | |
| - name: Run tests | |
| run: tox -e py | |
| tests-misc: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| env: [generate-integration-files, type, lint, format] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install tox | |
| - name: Run ${{ matrix.env }} | |
| run: tox -e ${{ matrix.env }} | |
| build: | |
| needs: [tests-py, tests-misc] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| # fetch all commits for setuptools_scm | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Build | |
| run: python setup.py sdist bdist_wheel | |
| - name: Save build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Restore build artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.pypi_password }} |