actions: review ruff and tests workflows #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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Run every Saturday at 3:00 AM | |
| schedule: | |
| # * is a special character in YAML so you have to quote this string | |
| - cron: '0 3 * * 6' | |
| workflow_dispatch: | |
| inputs: | |
| reason: | |
| required: false | |
| description: 'Reason' | |
| default: 'Manual trigger' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| env: | |
| # pak resolves `sits` from GitHub; without a token it shares the anonymous | |
| # rate limit with every other runner | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| test: | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| strategy: | |
| # Report every version, so a single break does not hide the others | |
| fail-fast: false | |
| matrix: | |
| # The suite trains various models on CPU. To reduce execution time, | |
| # a change is only checked against floor and ceiling versions. | |
| # The weekly test covers all other versions | |
| python-version: ${{ fromJSON((github.event_name == 'push' || github.event_name == 'pull_request') && '["3.10", "3.14"]' || '["3.10", "3.11", "3.12", "3.13", "3.14"]') }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/setup-pysits | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install pysits | |
| run: uv sync --locked --extra dev | |
| - name: Run tests | |
| run: uv run pytest | |
| latest-dependencies: | |
| name: Latest dependencies | |
| # `uv.lock` pins what `test` runs against, so a release that breaks pysits | |
| # stays invisible there until someone relocks. This resolves from scratch. | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: ./.github/actions/setup-pysits | |
| with: | |
| python-version: '3.14' | |
| - name: Install pysits, ignoring the lockfile | |
| run: uv sync --upgrade --extra dev | |
| - name: Run tests | |
| run: uv run pytest |