-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (59 loc) · 2.26 KB
/
test_count.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
name: Test Count And Coverage
on:
push:
branches:
- main # Adjust this if your main branch has a different name
jobs:
count_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --all-extras --dev
- name: Set up Node.js
uses: actions/setup-node@v4
- name: Install NPM dependencies
run: npm install
working-directory: ./app/web_ui
- name: Count Python tests
run: |
PYTHON_TEST_COUNT=$(uv run python3 -m pytest --collect-only -q . | grep "tests collected" | awk '{print $1}' | sed 's/[^0-9]//g')
echo "PYTHON_TEST_COUNT=$PYTHON_TEST_COUNT" >> $GITHUB_ENV
- name: Count NPM tests
run: |
JS_TEST_COUNT=$(npx vitest run --no-color | grep 'Tests *[0-9]* passed ([0-9]*)' | awk '{print $2}' | sed 's/[^0-9]*//g')
echo "JS_TEST_COUNT=$JS_TEST_COUNT" >> $GITHUB_ENV
working-directory: ./app/web_ui
- name: Calculate total test count
run: |
TOTAL_TEST_COUNT=$((PYTHON_TEST_COUNT + JS_TEST_COUNT))
echo "TOTAL_TEST_COUNT=$TOTAL_TEST_COUNT" >> $GITHUB_ENV
- name: Create test count badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 57742c1b1b60d597a6aba5d5148d728e
filename: test_count_kiln.json
label: Test Count
message: ${{ env.TOTAL_TEST_COUNT }}
color: brightgreen
- name: Run library coverage
run: |
uv run coverage run -m pytest -q ./libs/
TOTAL_LIB_COVERAGE=$(uv run coverage report | grep TOTAL | awk {'print $4'})
echo "TOTAL_LIB_COVERAGE=$TOTAL_LIB_COVERAGE" >> $GITHUB_ENV
- name: Create coverage badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 57742c1b1b60d597a6aba5d5148d728e
filename: library_coverage_kiln.json
label: Coverage
message: ${{ env.TOTAL_LIB_COVERAGE }}
color: brightgreen