Add test results reporting for Codecov #67
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: "Python" | |
on: | |
push: | |
paths: | |
- ".github/workflows/python.yaml" | |
- "pyproject.toml" | |
- "**/*.py" | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: "Setup Python" | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: "3.x" | |
allow-prereleases: true | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: "Install dependencies" | |
run: python -m pip install .[dev,tests] | |
- name: "Check formatting" | |
run: python -m ruff format --check . | |
- name: "Run ruff" | |
run: python -m ruff check --output-format=github . | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: "Setup Python" | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: "3.x" | |
cache: "pip" | |
cache-dependency-path: "pyproject.toml" | |
- name: "Install dependencies" | |
run: | | |
python -m pip install coverage pytest | |
python -m pip install --editable .[dev,tests] | |
python -m pip install --editable scratch/projects/one_two_three | |
- name: "Run tests" | |
run: python -m coverage run -m pytest --junitxml=junit.xml -o junit_family=legacy | |
- name: "Upload coverage reports to Codecov" | |
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload test results to Codecov | |
if: ${{ !cancelled() }} | |
uses: codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820 # v1.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |