swap coveralls image for codecov #13
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests and push coverage to Codecov | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
# Cache package installation step to speed up the following step | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} }} | |
- name: Install deps | |
run: | | |
pip install --upgrade --upgrade-strategy eager -e . | |
pip check | |
test: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
# Cache package installation step to speed up the following step | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} | |
- name: Install pytest | |
run: pip install pytest pytest-cov | |
- name: Run pytest | |
run: pytest --cov --rootdir=/home/runner/work/stranger | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage${{ matrix.group }} | |
path: .coverage | |
coverage: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Install deps | |
run: | | |
python -m pip install --upgrade pip | |
pip install coverage | |
- name: Download all artifacts | |
# Download and combine coverage1, coverage2, etc. | |
uses: actions/download-artifact@v4 | |
- name: Run coverage | |
run: | | |
coverage combine coverage*/.coverage* | |
coverage report | |
coverage xml | |
- uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |