Repository navigation
78 lines (78 loc) · 3.01 KB
/
Copy pathpython-package.yml
File metadata and controls
78 lines (78 loc) · 3.01 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
---
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
name: Lint (pydoclint, pre-commit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# The pre-commit hook `check-notebooks-were-run` needs the PR's own
# commit (not the merge commit that GitHub creates for the PR), and
# the full git history to find the latest commit from main in it
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Set up Python 3.13
uses: actions/setup-python@v7
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run pydoclint and pre-commit
# The options after `--` go to `pre-commit run` (pydoclint ignores
# them). `--show-diff-on-failure` prints the changes that the hooks
# made, since the modified files are discarded with the runner.
run: tox -e pydoclint,pre-commit -- -a --show-diff-on-failure
notebooks:
# Runs every example notebook in a clean environment, without saving them.
# The pre-commit hook `check-notebooks-were-run` (in the lint job above)
# only checks that the notebooks were re-run during this PR, on the
# contributor's own machine. This job also catches notebooks that fail:
# - because of code changes made after the notebooks were re-run
# - outside the contributor's machine (e.g., because of a package that is
# only installed locally, or a data file that was not committed)
# - with the latest versions of the dependencies, or with the latest
# `main` (CI runs this PR merged into `main`)
name: Run example notebooks
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.13
uses: actions/setup-python@v7
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Execute every notebook in examples/
run: tox -e notebooks
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ['3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox