Wire the workflows to master, the repo default branch #2
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: CI | |
| # Only master and the pull requests aimed at it. Feature branches stay quiet until | |
| # you open a PR, so day-to-day work doesn't burn Actions minutes. | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| smoke: | |
| name: Import, build and boot | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ["3.10", "3.13"] | |
| exclude: | |
| # one Python per non-Linux runner is enough signal for a local-first app | |
| - os: windows-latest | |
| python-version: "3.10" | |
| - os: macos-latest | |
| python-version: "3.10" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install the package as a user would | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install . | |
| - name: Run the smoke test | |
| # Installs from the wheel, so this also catches templates/static or the | |
| # vendored pdf.js being left out of the package. | |
| run: python tests/smoke_test.py | |
| version: | |
| name: Version bump reminder | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Compare __version__ with the base branch | |
| # Not a failure: plenty of PRs (docs, CI, refactors) shouldn't release. | |
| # It just makes "this merge will publish / won't publish" visible before | |
| # the merge instead of after. | |
| run: | | |
| read_version() { python -c "import re,sys;print(re.search(r'__version__ = \"([^\"]+)\"', open(sys.argv[1]).read()).group(1))" "$1"; } | |
| HEAD_VERSION=$(read_version markai/__init__.py) | |
| git show "origin/${{ github.base_ref }}:markai/__init__.py" > /tmp/base_init.py | |
| BASE_VERSION=$(read_version /tmp/base_init.py) | |
| if [ "$HEAD_VERSION" = "$BASE_VERSION" ]; then | |
| echo "::notice::__version__ is unchanged ($HEAD_VERSION). Merging this PR will NOT publish a release." | |
| else | |
| echo "::notice::__version__ goes $BASE_VERSION -> $HEAD_VERSION. Merging this PR WILL publish $HEAD_VERSION to PyPI." | |
| fi |