Skip to content

tests

tests #245

Workflow file for this run

name: tests
on:
push:
pull_request_target:
schedule: # This is useful for keeping the cache fit and ready
- cron: "42 3 * * 0" # Every Sunday morning when I am fast asleep :)
workflow_dispatch:
jobs:
deploy:
name: python-${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
fail-fast: false
runs-on: ${{ matrix.os }}
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up uv
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }}
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up uv
if: ${{ matrix.os == 'windows-latest' }}
run: irm https://astral.sh/uv/install.ps1 | iex
shell: powershell
- name: Cache folder for uv
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Cache folder for data
uses: actions/cache@v4
id: cache-folder
with:
path: |
${{ github.workspace }}/cache_opensky
key: opensky-${{ runner.os }}-${{ hashFiles('uv.lock') }}
- name: Install the project
run: uv sync --all-extras --dev --python ${{ matrix.python-version }}
- name: Linting and formatting
run: |
uv run ruff check
uv run ruff format --check
- name: Run tests
if: ${{ matrix.python-version == '3.12' || steps.cache-folder.outputs.cache-hit == 'true' }}
env:
OPENSKY_USERNAME: ${{ secrets.OPENSKY_USERNAME }}
OPENSKY_PASSWORD: ${{ secrets.OPENSKY_PASSWORD }}
OPENSKY_CACHE: ${{ github.workspace }}/cache_opensky
run: uv run pytest
- name: Minimize uv cache
run: uv cache prune --ci