-
-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (92 loc) · 2.81 KB
/
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: "Test"
on:
pull_request:
push:
branches:
- "main"
- "releases"
jobs:
test:
name: "Test"
runs-on: "windows-latest"
steps:
# The week number is used for cache-busting.
- name: "Identify week number"
shell: "bash"
run: "date +'%V' > week-number.txt"
- name: "Checkout branch"
uses: "actions/checkout@v3"
- name: "Setup Pythons"
id: "setup-python"
uses: "actions/setup-python@v4"
with:
python-version: |
3.8
3.9
3.10
3.12
3.11
allow-prereleases: true
# Cache packages that pip downloads.
# This does not cache the installed files.
cache: "pip"
cache-dependency-path: |
.github/workflows/test.yaml
pyproject.toml
tox.ini
week-number.txt
- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@v3"
with:
path: |
.tox/
.venv/
key: "test-hash=${{ hashFiles('.github/workflows/test.yaml', 'pyproject.toml', 'tox.ini', 'week-number.txt') }}"
- name: "Create a virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
.venv/Scripts/python -m pip install --upgrade pip setuptools wheel
.venv/Scripts/pip install tox
- name: "Test"
run: .venv/Scripts/tox run
lint:
name: "Lint"
runs-on: "windows-latest"
steps:
# The week number is used for cache-busting.
- name: "Identify week number"
run: "date +'%V' > week-number.txt"
- name: "Checkout branch"
uses: "actions/checkout@v3"
- name: "Setup Pythons"
id: "setup-python"
uses: "actions/setup-python@v4"
with:
python-version: "3.11"
# Cache packages that pip downloads.
# This does not cache the installed files.
cache: "pip"
cache-dependency-path: |
.github/workflows/test.yaml
pyproject.toml
tox.ini
week-number.txt
- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@v3"
with:
path: |
.mypy_cache/
.tox/
.venv/
key: "lint-hash=${{ hashFiles('.github/workflows/test.yaml', 'pyproject.toml', 'tox.ini', 'week-number.txt') }}"
- name: "Create a virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
.venv/Scripts/python -m pip install --upgrade pip setuptools wheel
.venv/Scripts/pip install tox
- name: "Lint type annotations"
run: .venv/Scripts/tox run -e mypy