-
Notifications
You must be signed in to change notification settings - Fork 3
84 lines (82 loc) · 2.5 KB
/
lint-and-test.yaml
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
83
84
name: Lint and test nnbench
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
env:
MYPY_CACHE_DIR: "${{ github.workspace }}/.cache/mypy"
RUFF_CACHE_DIR: "${{ github.workspace }}/.cache/ruff"
PRE_COMMIT_HOME: "${{ github.workspace }}/.cache/pre-commit"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python and dependencies
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: pip
cache-dependency-path: |
requirements-dev.txt
requirements-docs.txt
pyproject.toml
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
pip install -e . --no-deps
- name: Cache pre-commit tools
uses: actions/cache@v4
with:
path: |
${{ env.MYPY_CACHE_DIR }}
${{ env.RUFF_CACHE_DIR }}
${{ env.PRE_COMMIT_HOME }}
key: ${{ hashFiles('requirements-dev.txt', '.pre-commit-config.yaml') }}-linter-cache
- name: Run pre-commit checks
run: pre-commit run --all-files --verbose --show-diff-on-failure
test:
name: Test nnbench on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- uses: actions/checkout@v4
- name: Set up oldest supported Python on ${{ matrix.os }}
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Run tests on oldest supported Python
run: |
python -m pip install ".[dev]"
pytest
docs:
name: Publish latest documentation for nnbench
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python and dependencies
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: pip
cache-dependency-path: |
requirements-dev.txt
requirements-docs.txt
pyproject.toml
- name: Install dependencies
run: |
pip install -r requirements-dev.txt -r requirements-docs.txt
pip install -e . --no-deps
- uses: ./.github/actions/mike-docs
with:
version: latest
pre_release: true # include pre-release notification banner
push: ${{ github.ref == 'refs/heads/main' }} # build always, publish on 'main' only to prevent version clutter