Skip to content

Update revrt-CLI (#327) #836

Update revrt-CLI (#327)

Update revrt-CLI (#327) #836

Workflow file for this run

name: Python checks
permissions:
contents: read
concurrency:
group: python-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 7 * * 1'
workflow_dispatch:
jobs:
lint:
name: Lint Python Code Base
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Lint Python Code (Ruff)
uses: astral-sh/ruff-action@278981a28ce3188b1e39527901f38254bf3aac89 # v3.6.1
with:
version: "latest"
args: "check"
src: "./revrt"
- name: Check Python Code Format (Ruff)
uses: astral-sh/ruff-action@278981a28ce3188b1e39527901f38254bf3aac89 # v3.6.1
with:
version: "latest"
args: "format --check"
src: "./revrt"
- name: Check Python Code Complexity (Complexipy)
uses: rohaquinlop/complexipy-action@e2b05bcc06d899a24e2b6bb8b1354ac42800a95e # v7.0.1
with:
paths: "./revrt"
max_complexity_allowed: 10
failed: false # true
sort: desc
ignore_complexity: false # Set to true to ignore complexity checks
locked-tests:
needs: lint
name: Pixi-Locked Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 8
steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
- uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1
with:
pixi-version: v0.69.0
locked: true
cache: true
cache-write: false
environments: dev
- run: |
pixi reinstall -e dev --locked NLR-reVRt
unit-tests:
needs: lint
name: Python Unit Tests (Pixi)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 8
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
- name: Set up MSVC developer command prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1
with:
pixi-version: v0.69.0
locked: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: dev
- run: |
pixi reinstall -e dev NLR-reVRt
pixi run -e dev tests-u
integration-tests:
needs: lint
name: Python Integration Tests (Pixi)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 8
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout Repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
- name: Set up MSVC developer command prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1
with:
pixi-version: v0.69.0
locked: true
cache: true
cache-write: ${{ github.ref == 'refs/heads/main' }}
environments: dev
- run: |
pixi reinstall -e dev NLR-reVRt
pixi run -e dev tests-i
tox-tests:
needs: lint
name: Python tests (Tox)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 8
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Fiona currently falls back to an sdist on Python 3.14, which
# requires a system GDAL install that this tox job does not provide.
# When this is fixed on Fiona's end, we can re-enable Python 3.14 testing here.
python-version: ['3.13', '3.12',]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
- name: Set up MSVC developer command prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions>=2.0
- name: Load tox cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .tox/
key: ${{ runner.os }}-${{ matrix.python-version }}-tox-v1-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-tox-v1-
- name: Test with tox
run: tox -e ${{ matrix.python-version == '3.12' && 'msv' || 'latest' }}
env:
PYTHONDEVMODE: 1
REVRT_TOX_TEST_PATH: ${{ github.ref == 'refs/heads/main' && 'tests' || 'tests/python/unit' }}
- name: Save tox cache only on main
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: .tox/
key: ${{ runner.os }}-${{ matrix.python-version }}-tox-v1-${{ hashFiles('**/pyproject.toml') }}