-
-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (65 loc) · 2.21 KB
/
Copy pathci.yml
File metadata and controls
70 lines (65 loc) · 2.21 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
name: ci
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: test (arviz ${{ matrix.arviz }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# "locked" uses the arviz version pinned in uv.lock (>=1.0).
# "legacy" downgrades to arviz<1.0 to exercise the real
# az.InferenceData dispatch branch (skipped on >=1.0 where
# az.InferenceData is aliased to xarray.DataTree).
arviz: [locked, legacy]
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
- name: Install dependencies
run: uv sync --all-extras
- name: Pin legacy arviz (<1.0)
if: matrix.arviz == 'legacy'
# Override the lock's arviz>=1.0 with a legacy release so the
# real-InferenceData test variants activate instead of skipping.
run: uv pip install 'arviz<1.0'
- name: Run tests
# --no-sync so the legacy-arviz downgrade from the previous step
# is not reverted by `uv run` reconciling back to uv.lock.
run: uv run --no-sync pytest -v
prek:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v8.2.0
- name: Install dependencies
# Locked install so the mypy hook sees project deps, matching local
# `make lint` behaviour.
run: uv sync --all-extras
- name: Run prek on changed files in PRs
if: github.event_name == 'pull_request'
run: uv run prek run --from-ref "$BASE_SHA" --to-ref "$HEAD_SHA"
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
- name: Run prek on all files on pushes
if: github.event_name != 'pull_request'
run: uv run prek run --all-files