generated from MultifokalHirn/python_template_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (71 loc) · 2.06 KB
/
python-checks.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
---
name: Python Checks
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
branches: ["main"]
paths-ignore:
- "docs/**"
- "**/*.rst"
- "**/*.md"
- .gitignore
- LICENSE
- CHANGELOG.md
- CONTRIBUTING.md
permissions:
contents: read
jobs:
build:
# name: Build and Test
runs-on: ubuntu-latest
strategy:
# max-parallel: 1
fail-fast: false
matrix:
python-version: [3.11, 3.12]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set Variables
id: set_variables
shell: bash
run: |
echo "PY=$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" >> $GITHUB_OUTPUT
echo "PIP_CACHE=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache PIP
uses: actions/cache@v3
with:
path: ${{ steps.set_variables.outputs.PIP_CACHE }}
key: ${{ runner.os }}-pip-${{ steps.set_variables.outputs.PY }}
- name: Cache venv
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pdm.lock') }}
restore-keys: |
venv-${{ runner.os }}-${{ matrix.python-version }}-
id: cache
- name: Setup virtual environment
if: steps.cache.outputs.cache-hit != 'true'
run: make bootstrap
- name: Install prod and dev dependencies
run: make prod dev
- name: Run tests
run: make test
- name: Run typechecks
run: make mypy
- name: Lint
run: make lint
# - name: Install dependencies
# run: |
# python -m pip install --upgrade tox .
# - name: Test with tox
# run: |
# tox --version
# pyversion="${{ matrix.python-version }}"
# tox -e py${pyversion/./}