This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (112 loc) · 3.69 KB
/
check.yml
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Check
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
# no hardcode os-specific path
id: pip-cache-dir
- name: pip cache
id: pip-cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-${{ github.job }}-${{ hashFiles('poetry.lock') }}
restore-keys: pip-${{ github.job }}
- name: pre-commit cache
id: pre-commit-cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: pre-commit-
- run: pip install tox poetry pre-commit
- name: Show versions
run: |
uname -a
python3 --version
echo "tox: $(tox --version)"
poetry --version
- uses: isort/isort-action@v1
- uses: psf/black@stable
- name: tox dir
id: tox-dir
uses: actions/cache@v4
with:
path: .tox
key: tox-${{ github.job }}-${{ hashFiles('poetry.lock', 'tox.ini') }}
restore-keys: tox-${{ github.job }}-
- run: tox run -e lint
env:
# avoid blocking workflow and release if failing poetry audit;
# dependabot should raise alert already
SKIP: black,isort,poetry-audit
tests:
needs: lint
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
# no hardcode os-specific path
id: pip-cache-dir
- name: pip cache
id: pip-cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-${{ github.job }}-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: pip-${{ github.job }}-${{ matrix.os }}-${{ matrix.python-version }}-
- run: pip install tox poetry
- name: Show versions
run: |
uname -a
python3 --version
echo "tox: $(tox --version)"
poetry --version
- name: tox dir
id: tox-dir
uses: actions/cache@v4
with:
path: .tox
key: tox-${{ github.job }}-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock', 'tox.ini') }}
restore-keys: tox-${{ github.job }}-${{ matrix.os }}-${{ matrix.python-version }}-
- run: tox run -e tests
# Run tox using py: The current Python version tox is using
build:
needs: tests
name: Build distribution packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
# no hardcode os-specific path
id: pip-cache-dir
- name: pip cache
id: pip-cache
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache-dir.outputs.dir }}
key: pip-${{ github.job }}-${{ hashFiles('pyproject.toml') }}
restore-keys: pip-${{ github.job }}-
- run: pip install build
- name: Show versions
run: |
uname -a
python3 --version
python3 -m build --version
- run: python3 -m build