forked from Axenide/Ax-Shell
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 1.75 KB
/
test.yml
File metadata and controls
52 lines (44 loc) · 1.75 KB
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
name: Tests
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Install system dependencies
run: sudo apt-get install -y --no-install-recommends libegl1
- name: Install test dependencies
run: |
uv venv
uv pip install pytest pytest-cov toml psutil loguru requests PySide6 "glaze @ git+https://github.com/awareness10/glaze"
- name: Run tests with coverage
env:
PYTHONPATH: .
run: uv run --no-project pytest --tb=short --cov-report=json:coverage.json
- name: Extract coverage percentage
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
id: coverage
run: |
COV=$(python -c "import json; print(int(json.load(open('coverage.json'))['totals']['percent_covered']))")
echo "percentage=$COV" >> "$GITHUB_OUTPUT"
if [ "$COV" -ge 90 ]; then echo "color=brightgreen" >> "$GITHUB_OUTPUT"
elif [ "$COV" -ge 75 ]; then echo "color=green" >> "$GITHUB_OUTPUT"
elif [ "$COV" -ge 60 ]; then echo "color=yellow" >> "$GITHUB_OUTPUT"
else echo "color=red" >> "$GITHUB_OUTPUT"; fi
- name: Update coverage badge
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_TOKEN }}
gistID: ${{ vars.COVERAGE_GIST_ID }}
filename: coverage.json
label: coverage
message: ${{ steps.coverage.outputs.percentage }}%
color: ${{ steps.coverage.outputs.color }}