-
Notifications
You must be signed in to change notification settings - Fork 14
62 lines (51 loc) · 1.7 KB
/
build.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
name: "Build"
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Ruff & Pytest
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
uv-version: ["0.3.3"]
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/${{ matrix.uv-version }}/install.sh | sh
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install the project
run: uv sync --frozen --no-cache
- name: Run Ruff code analysis
run: uv run ruff check .
- name: Run tests suite
run: |
PYTHONPATH=app/ uv run python -m pytest -v --cov-fail-under=80 --cov-report=html --cov=app/ tests/
PERCENT=$(cat htmlcov/index.html | grep "pc_cov" | awk -F '>' '{print $2}' | awk -F '%' '{print $1}')
echo "COVERAGE=$PERCENT" >> $GITHUB_ENV
- name: Update test coverage badge
if: github.event_name == 'push'
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 1362ebafcd51d3f65dae7935b1d322eb
filename: pytest.json
label: coverage
message: ${{ env.COVERAGE }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.COVERAGE }}
- name: Update python version badge
if: github.event_name == 'push'
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 15a234815aa74059953a766a10e92688
filename: python-version.json
label: python
message: v${{ matrix.python-version }}
color: blue