forked from ImperialCollegeLondon/PyProBE
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (67 loc) · 2.41 KB
/
Copy pathci-pull-request.yml
File metadata and controls
74 lines (67 loc) · 2.41 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
name: "CI for Pull Requests"
on:
pull_request:
branches:
- main
paths:
- pyprobe/**
- tests/**
- docs/source/examples/*ipynb
- pyproject.toml
- .github/workflows/ci-pull-request.yml
- uv.lock
workflow_dispatch:
permissions:
contents: read
checks: write
jobs:
# Matrix job for pull requests
test-matrix:
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
strategy:
matrix:
python-version: ["3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v8.1.0
with:
version: "0.11.8"
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Run tests with frozen dependencies
run: uv run --all-extras --frozen --isolated pytest --cov --cov-report=xml -n auto
- name: Upload coverage reports to Codecov
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Test notebooks
shell: bash
run: |
shopt -s extglob
uv run --all-extras --frozen --isolated pytest --nbmake docs/source/examples/!(comparing-pyprobe-performance).ipynb
- name: Test upgraded dependencies
run: uv run --extra dev --upgrade --isolated pytest -n auto
- name: Build and test distribution installation (Linux/macOS)
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
uv sync --all-extras --frozen
uv build
uv venv --clear
WHEEL_FILE=$(ls dist/*.whl | head -n 1)
uv pip install ${WHEEL_FILE}[hvplot,seaborn,dev,docs,pybamm]
uv run --no-sync pytest -n auto
- name: Build and test distribution installation (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
uv sync --all-extras --frozen
uv build
uv venv --clear
$wheelFile = Get-ChildItem dist/*.whl | Select-Object -First 1 | ForEach-Object { $_.FullName }
$wheel = $wheelFile + "[hvplot,seaborn,dev,docs,pybamm]"
uv pip install $wheel
uv run --no-sync pytest -n auto