This repository was archived by the owner on Apr 30, 2026. It is now read-only.
Doc improvments #11
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: Pull Request Checks | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| test_and_check_version: | |
| name: Test and Check Version | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out base branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.base_ref }} | |
| path: 'main' | |
| - name: Check out PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| path: 'pr' | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Install dependencies | |
| working-directory: ./pr | |
| run: poetry install --no-interaction --no-root | |
| - name: Set PYTHONPATH | |
| working-directory: ./pr | |
| run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)" >> $GITHUB_ENV | |
| - name: Run tests | |
| working-directory: ./pr | |
| run: | | |
| source .venv/bin/activate | |
| poetry run pytest | |
| - name: Check for version increment | |
| id: check_version | |
| run: | | |
| # Install toml-cli, a tool for reading TOML files | |
| pip install toml-cli | |
| # Extract version from the main branch's pyproject.toml | |
| main_version=$(toml get --toml-path main/pyproject.toml tool.poetry.version) | |
| echo "Version on main: $main_version" | |
| # Extract version from the PR branch's pyproject.toml | |
| pr_version=$(toml get --toml-path pr/pyproject.toml tool.poetry.version) | |
| echo "Version on PR branch: $pr_version" | |
| if [ "$main_version" == "$pr_version" ]; then | |
| echo "Version has not been incremented from main." | |
| exit 1 | |
| fi | |
| # The `sort -V` command handles version numbers correctly. | |
| # It understands that 0.1.10 is greater than 0.1.9. | |
| if [ "$(printf '%s\n' "$main_version" "$pr_version" | sort -V | head -n1)" != "$main_version" ]; then | |
| echo "PR version ($pr_version) is not greater than main version ($main_version)." | |
| exit 1 | |
| fi | |
| echo "Version check passed!" |