Update pre-commit hooks #1473
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
| name: build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - '*.md' | |
| pull_request: | |
| branches: | |
| - main | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| python-version: '3.13' | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 | |
| with: | |
| disable-sudo: true | |
| egress-policy: block | |
| allowed-endpoints: > | |
| files.pythonhosted.org:443 | |
| pypi.org:443 | |
| github.com:443 | |
| api.github.com:443 | |
| *.githubusercontent.com:443 | |
| ghcr.io | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ env.python-version }} | |
| - name: Lint with Pre-commit | |
| run: pipx run --pip-args='--constraint=.github/github-requirements.txt' pre-commit run --all-files | |
| - name: Check REUSE compliance | |
| run: pip install reuse && python -m reuse lint | |
| - name: Check Poetry lock file integrity | |
| run: | | |
| python${{ env.python-version }} -m pip install --constraint=.github/github-requirements.txt poetry | |
| poetry config virtualenvs.in-project true | |
| poetry check | |
| build: | |
| needs: lint | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
| name: build (python ${{ matrix.python-version }}) | |
| outputs: | |
| targz: generic-${{ steps.meta.outputs.version }}.tar.gz | |
| wheel: generic-${{ steps.meta.outputs.version }}-py3-none-any.whl | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 | |
| with: | |
| disable-sudo: true | |
| egress-policy: block | |
| allowed-endpoints: > | |
| qlty.sh/d/coverage:443 | |
| qlty-releases.s3.amazonaws.com:443 | |
| files.pythonhosted.org:443 | |
| pypi.org:443 | |
| github.com:443 | |
| *.githubusercontent.com:443 | |
| ghcr.io | |
| keys.openpgp.org:443 | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| allow-prereleases: true | |
| - name: Install Poetry | |
| run: | | |
| python${{ matrix.python-version }} -m pip install --constraint=.github/github-requirements.txt poetry | |
| poetry config virtualenvs.in-project true | |
| - name: Collect Project Data | |
| id: meta | |
| run: .github/scripts/metadata.sh | |
| - name: Install dependencies | |
| run: poetry install --no-interaction | |
| - name: Test | |
| run: | | |
| poetry run pytest --cov=generic | |
| poetry run coverage lcov | |
| - name: Upload Code Coverage to Qlty.sh | |
| uses: qltysh/qlty-action/coverage@a19242102d17e497f437d7466aa01b528537e899 # v2.2.0 | |
| with: | |
| token: ${{ secrets.QLTY_COVERAGE_TOKEN }} | |
| files: coverage.lcov | |
| - name: Create Source Dist and Wheel | |
| if: ${{ matrix.python-version == env.python-version }} | |
| run: poetry build | |
| - name: Upload generic-${{ steps.meta.outputs.version }}.tar.gz | |
| if: ${{ matrix.python-version == env.python-version }} | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: generic-${{ steps.meta.outputs.version }}.tar.gz | |
| path: dist/generic-${{ steps.meta.outputs.version }}.tar.gz | |
| - name: Upload generic-${{ steps.meta.outputs.version }}-py3-none-any.whl | |
| if: ${{ matrix.python-version == env.python-version }} | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: generic-${{ steps.meta.outputs.version }}-py3-none-any.whl | |
| path: dist/generic-${{ steps.meta.outputs.version }}-py3-none-any.whl | |
| publish-to-pypi: | |
| name: Publish to PyPI (release only) | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write | |
| if: ${{ github.event_name == 'release' }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 | |
| with: | |
| egress-policy: audit | |
| - name: Download tar.gz | |
| uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 | |
| with: | |
| name: ${{ needs.build.outputs.targz }} | |
| path: dist | |
| - name: Download wheel | |
| uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 | |
| with: | |
| name: ${{ needs.build.outputs.wheel }} | |
| path: dist | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1 |