mirror of https://github.com/razor-ai/soup.git
57 lines
2.0 KiB
YAML
57 lines
2.0 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:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
python-version: ["3.9", "3.11", "3.12"]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dependencies
|
|
run: pip install -e ".[dev]"
|
|
- name: Run unit tests with coverage
|
|
run: pytest tests/ -v --tb=short --junitxml=report.xml --cov=soup_cli --cov-report=xml:coverage.xml --cov-report=term-missing:skip-covered
|
|
- name: Upload coverage to Codecov
|
|
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
|
|
uses: codecov/codecov-action@v4
|
|
with:
|
|
files: coverage.xml
|
|
fail_ci_if_error: false
|
|
- name: Update test count badge
|
|
if: matrix.os == 'ubuntu-latest' && 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"
|