-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (66 loc) · 2 KB
/
code-quality.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
---
name: Code Quality
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
name: Pre-commit
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: get python version
run: |
python_version=$(cat .python-version)
echo "python_version=${python_version}" >> $GITHUB_ENV
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- uses: pre-commit/action@v3.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
test:
name: Test
runs-on: ubuntu-24.04
env:
HAS_CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
- name: get python version
run: |
python_version=$(cat .python-version)
echo "python_version=${python_version}" >> $GITHUB_ENV
- uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: setup poetry
run: |
pipx install poetry==1.8.4
- name: load poetry install from cache
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.python_version }}-${{ hashFiles('**/poetry.lock') }}
- run: |
poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: load .tox from cache
id: cached-tox-dependencies
uses: actions/cache@v4
with:
path: .tox
key: venv-${{ runner.os }}-${{ env.python_version }}-${{ hashFiles('**/poetry.lock') }}
- run: poetry run tox -e test-coverage
- uses: codecov/codecov-action@v4
if: ${{ env.HAS_CODECOV_TOKEN }} && hashFiles('./coverage.xml') != ''
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
- name: clean up .tox
run: |
rm -f .tox/log/*
rm -f .tox/test-coverage/log/*