| 1 |
name: Calculate test coverage |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- main |
| 10 |
permissions: |
| 11 |
contents: read |
| 12 |
|
| 13 |
jobs: |
| 14 |
test: |
| 15 |
runs-on: ubuntu-latest |
| 16 |
steps: |
| 17 |
- name: Check out datasette |
| 18 |
uses: actions/checkout@v7 |
| 19 |
- name: Set up Python |
| 20 |
uses: actions/setup-python@v7 |
| 21 |
with: |
| 22 |
python-version: "3.10" |
| 23 |
- uses: actions/cache@v6 |
| 24 |
name: Configure pip caching |
| 25 |
with: |
| 26 |
path: ~/.cache/pip |
| 27 |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} |
| 28 |
restore-keys: | |
| 29 |
${{ runner.os }}-pip- |
| 30 |
- name: Install Python dependencies |
| 31 |
run: | |
| 32 |
python -m pip install --upgrade pip |
| 33 |
python -m pip install -e .[test] |
| 34 |
python -m pip install pytest-cov |
| 35 |
- name: Run tests |
| 36 |
run: |- |
| 37 |
ls -lah |
| 38 |
cat .coveragerc |
| 39 |
pytest --cov=datasette --cov-config=.coveragerc --cov-report xml:coverage.xml --cov-report term |
| 40 |
ls -lah |
| 41 |
- name: Upload coverage report |
| 42 |
uses: codecov/codecov-action@v1 |
| 43 |
with: |
| 44 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 45 |
file: coverage.xml |