Skip to content

chore(deps): update dependency ruff to v0.12.4 #46

chore(deps): update dependency ruff to v0.12.4

chore(deps): update dependency ruff to v0.12.4 #46

Workflow file for this run

name: Run tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11" # Always use the lowest possible version to ensure correctness of the code.
#----------------------------------------------
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
#----------------------------------------------
- name: Install ruff
run: python -m pip install ruff
- name: Check python code
if: always()
run: ruff check --no-fix .
- name: Check formatting style
if: always()
run: ruff format --diff .
#----------------------------------------------
generate-stubs:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: cache poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-ubuntu-latest-3.11
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-ubuntu-latest-3.11-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Install ${{ github.event.repository.name }}
run: poetry install --no-interaction
- name: Generate stubs
run: poetry run ./restub
- name: Check for changes
id: check-changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
if git diff --quiet src/smartschool; then
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "changes_detected=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check-changes.outputs.changes_detected == 'true'
run: |
git add src/smartschool
git commit -m "Auto-update stub files"
git push
tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: cache poetry install
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ matrix.os }}-${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install ${{ github.event.repository.name }}
run: poetry install --no-interaction
- name: Run tests
run: |
source .venv/bin/activate
pytest --cov=${{ github.event.repository.name }} --cov-append --cov-fail-under=90 --cov-branch --cov-report=json --cov-report=term
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}