Document pre-commit #17
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: Tests | |
| on: | |
| push: | |
| branches: ["main"] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: ["main"] | |
| jobs: | |
| build-docs: | |
| name: Build HTML docs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # needed for hatch-vcs to read tags | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Create documentation | |
| run: make html | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install package and test dependencies | |
| run: make venv | |
| - name: Run tests | |
| run: make test | |
| test-distribution: | |
| name: Check built package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build distribution files | |
| run: python -m build # same as in deploy-tag-to-pypi | |
| - name: Check distribution files | |
| run: twine check dist/* | |
| publish: | |
| name: Publish to PyPI | |
| needs: | |
| - build-docs | |
| - test-distribution | |
| - test | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| environment: PyPI | |
| permissions: | |
| id-token: write # required for trusted publishing | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # needed for hatch-vcs to read tags | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Install build | |
| run: pip install build | |
| - name: Build distribution | |
| run: python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| deploy-github-release: | |
| # only deploy on tags, see https://stackoverflow.com/a/58478262/1320237 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: | |
| - build-docs | |
| - test-distribution | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create GitHub release from tag | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| body: "To view the changes, please see the [Changelog](https://sphinx-icalendar.readthedocs.io/en/latest/changelog.html). This release can be installed from [PyPI](https://pypi.org/project/sphinx-icalendar/)." | |
| generateReleaseNotes: false |