Skip to content

i.sam2: SamGeo2 model (#1244) #1

i.sam2: SamGeo2 model (#1244)

i.sam2: SamGeo2 model (#1244) #1

Workflow file for this run

---
name: Linting & formatting
on:
push:
branches:
- grass[0-9]+
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress:
# Do not cancel on protected branches, like grass8
${{ github.ref_protected != true }}
env:
# renovate: datasource=python-version depName=python
PYTHON_VERSION: "3.13"
# renovate: datasource=pypi depName=ruff
RUFF_VERSION: "0.9.5"
permissions: {}
jobs:
run-ruff:
name: Ruff formatting
# Using matrix just to get variables which are not environmental variables
# and also to sync with other workflows which use matrix.
strategy:
matrix:
include:
- os: ubuntu-24.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
- name: Install
run: |
python -m pip install --upgrade pip
pip install ruff==${{ env.RUFF_VERSION }}
- name: Run Ruff (output annotations on fixable errors)
run: ruff check --output-format=github . --preview --unsafe-fixes
continue-on-error: true
- name: Run Ruff (apply fixes for suggestions)
run: ruff check . --preview --fix --unsafe-fixes
- name: Run `ruff format` showing diff without failing
continue-on-error: true
if: ${{ !cancelled() }}
run: ruff format --diff
- name: Run `ruff format` fixing files
# Run `ruff format` even when `ruff check` fixed files: fixes can require formatting
if: ${{ !cancelled() }}
run: ruff format
- name: Create and uploads code suggestions to apply for Ruff
# Will fail fast here if there are changes required
id: diff-ruff
# To run after ruff step exits with failure when rules don't have fixes available
if: ${{ !cancelled() }}
uses: OSGeo/grass/.github/actions/create-upload-suggestions@main
with:
tool-name: ruff
# To keep repo's file structure in formatted changes artifact
extra-upload-changes: pyproject.toml