-
Notifications
You must be signed in to change notification settings - Fork 13
82 lines (67 loc) · 2.16 KB
/
run_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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"
- "3.13"
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