-
-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (43 loc) · 1.54 KB
/
ci.yml
File metadata and controls
46 lines (43 loc) · 1.54 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install ruff
- run: ruff check soup_cli/ tests/
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev]"
- run: pytest tests/ -v --tb=short --junitxml=report.xml
- name: Update test count badge
if: matrix.python-version == '3.11' && github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
TESTS=$(python -c "
import xml.etree.ElementTree as ET
root = ET.parse('report.xml').getroot()
ts = root.find('testsuite')
print(ts.attrib.get('tests', '0') if ts is not None else root.attrib.get('tests', '0'))
")
echo "Test count: $TESTS"
curl -s -o /dev/null -w "%{http_code}" \
-X PATCH \
-H "Authorization: token ${{ secrets.GIST_TOKEN }}" \
-d "{\"files\":{\"soup_tests.json\":{\"content\":\"{\\\"schemaVersion\\\":1,\\\"label\\\":\\\"tests\\\",\\\"message\\\":\\\"$TESTS passed\\\",\\\"color\\\":\\\"brightgreen\\\"}\"}}}" \
"https://api.github.com/gists/65fdc943f85f3b2c46ecddb415c2b779"