-
Notifications
You must be signed in to change notification settings - Fork 10
51 lines (48 loc) · 1.76 KB
/
tests.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
name: tests
on:
push:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
strategy:
max-parallel: 3
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Build treams with tracing
run: CYTHON_COVERAGE=1 python -m pip install -e .
- name: Run tests
run: |
python -m pip install treams[test,coverage,io]
python -m pytest tests/unit --cov src/treams --cov-report html
- name: Get coverage report
run: |
python -m coverage json
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo -n "{ \"schemaVersion\": 1, \"label\": \"coverage\", \"message\": \"$TOTAL%\", \"color\": \"" > htmlcov/endpoint.json
if [ "$TOTAL" -lt 60 ]; then echo -n "red" >> htmlcov/endpoint.json; \
elif [ "$TOTAL" -lt 70 ]; then echo -n "orange" >> htmlcov/endpoint.json; \
elif [ "$TOTAL" -lt 80 ]; then echo -n "yellow" >> htmlcov/endpoint.json; \
elif [ "$TOTAL" -lt 90 ]; then echo -n "yellowgreen" >> htmlcov/endpoint.json; \
elif [ "$TOTAL" -lt 95 ]; then echo -n "green" >> htmlcov/endpoint.json; \
else echo -n "brightgreen" >> htmlcov/endpoint.json; fi
echo "\" }" >> htmlcov/endpoint.json
rm htmlcov/.gitignore
- name: Deploy report
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: htmlcov
FOLDER: htmlcov
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}