mirror of https://github.com/razor-ai/soup.git
47 lines
1.5 KiB
YAML
47 lines
1.5 KiB
YAML
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"
|