-
Notifications
You must be signed in to change notification settings - Fork 559
79 lines (67 loc) · 2.19 KB
/
Copy pathci.yml
File metadata and controls
79 lines (67 loc) · 2.19 KB
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
---
name: CI
permissions:
contents: read
on: # yamllint disable-line rule:truthy
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
CI:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
UV_LOCKED: 1
defaults:
run:
shell: bash -elo pipefail {0}
steps:
- name: Checkout repo
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: uv.lock
enable-cache: true
- name: Install dependencies
run: uv sync --all-extras --all-groups
# use a unique cache key for the current run attempt, ensuring it can
# later be saved. because that exact key is new, `restore-keys:` loads
# the newest cache from previous attempts as starting point to add to.
- name: Restore OSMnx cache
id: osmnx-cache
uses: actions/cache/restore@v6
with:
path: ./notebooks/cache
key: osmnx-cache-${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: osmnx-cache-
- name: Cache pre-commit
uses: actions/cache@v6
with:
path: ~/.cache/prek/
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit checks
run: uv run prek run --all-files
env:
SKIP: no-commit-to-branch
# test notebooks in parallel across 3 jobs with GNU parallel
- name: Test notebooks
run: |
cd ./notebooks
mkdir -p data images
uv run python -c "import osmnx; print(osmnx.__version__)"
uv run jupyter nbconvert --to python *.ipynb
parallel -j3 --line-buffer --tag 'uv run ipython {}' ::: *.py
# allow notebooks test runs to fail, but still save partial cache. this
# saves after ordinary failures but not if job is canceled or times out.
- name: Save notebook cache
if: always()
uses: actions/cache/save@v6
with:
path: ./notebooks/cache
key: ${{ steps.osmnx-cache.outputs.cache-primary-key }}