From cf7a2bdb404734910ec07abc7571351a2d934828 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sat, 13 Jun 2020 14:36:49 -0700 Subject: [PATCH] Action to run tests and upload coverage to codecov.io Closes #843. --- .github/workflows/test-coverage.yml | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/test-coverage.yml diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml new file mode 100644 index 0000000000..99c0526a16 --- /dev/null +++ b/.github/workflows/test-coverage.yml @@ -0,0 +1,41 @@ +name: Calculate test coverage + +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Check out datasette + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - uses: actions/cache@v2 + name: Configure pip caching + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install Python dependencies + run: | + python -m pip install -e .[test] + python -m pip install pytest-cov + - name: Run tests + run: |- + ls -lah + cat .coveragerc + pytest --cov=datasette --cov-config=.coveragerc --cov-report xml:coverage.xml --cov-report term + ls -lah + - name: Upload coverage report + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: coverage.xml