Merge pull request #180 from executablebooks/prek #421
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: continuous-integration | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| # To reduce rate limitation issues, avoid running multiple workflows in | |
| # paralell for the same git ref (PR / branch / tag) at the same time by | |
| # discarding older in-progress runs in favor of the newest. | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| # ref: https://github.com/j178/prek-action | |
| - uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0 | |
| - name: Help message if pre-commit fail | |
| if: ${{ failure() }} | |
| run: | | |
| echo "You can install pre-commit hooks (with prek or pre-commit) to" | |
| echo "automatically run formatting on each commit with:" | |
| echo " prek install" | |
| echo "or you can run by hand on staged files with" | |
| echo " prek run" | |
| echo "or after-the-fact on already committed files with" | |
| echo " prek run --all-files" | |
| tests: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| GITHUB_ACCESS_TOKEN: "${{ github.token }}" | |
| strategy: | |
| # max-parallel declared to reduce rate limitation issues | |
| max-parallel: 1 | |
| matrix: | |
| include: | |
| # Only test oldest supported and latest python version to reduce | |
| # GitHub API calls, as they can get rate limited | |
| - python-version: 3.x | |
| - python-version: "3.10" | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "${{ matrix.python-version }}" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[testing]" | |
| - name: Run tests | |
| run: pytest | |
| docs: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.14" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[sphinx]" | |
| - name: Build docs | |
| run: | | |
| cd docs | |
| make dirhtml |