Skip to content

Commit

Permalink
👷 Add Codecov to CI, Smokeshow/Cloudflare has been flaky lately
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Feb 20, 2025
1 parent 4dd320c commit 5259360
Showing 1 changed file with 48 additions and 41 deletions.
89 changes: 48 additions & 41 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,54 +74,61 @@ jobs:
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}-${{ matrix.pydantic-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
- name: Store coverage files
uses: actions/upload-artifact@v4
# - name: Store coverage files
# uses: actions/upload-artifact@v4
# with:
# name: coverage-${{ matrix.python-version }}-${{ matrix.pydantic-version }}
# path: coverage
# include-hidden-files: true
- uses: codecov/codecov-action@v5
with:
name: coverage-${{ matrix.python-version }}-${{ matrix.pydantic-version }}
path: coverage
include-hidden-files: true
fail_ci_if_error: true
files: ./coverage.xml
name: codecov-umbrella
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true

coverage-combine:
needs:
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
version: "0.4.15"
enable-cache: true
cache-dependency-glob: |
requirements**.txt
pyproject.toml
- name: Get coverage files
uses: actions/download-artifact@v4
with:
pattern: coverage-*
path: coverage
merge-multiple: true
- name: Install Dependencies
run: uv pip install -r requirements-tests.txt
- run: ls -la coverage
- run: coverage combine coverage
- run: coverage report
- run: coverage html --title "Coverage for ${{ github.sha }}"
- name: Store coverage HTML
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: htmlcov
include-hidden-files: true
# coverage-combine:
# needs:
# - test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.12'
# - name: Setup uv
# uses: astral-sh/setup-uv@v5
# with:
# version: "0.4.15"
# enable-cache: true
# cache-dependency-glob: |
# requirements**.txt
# pyproject.toml
# - name: Get coverage files
# uses: actions/download-artifact@v4
# with:
# pattern: coverage-*
# path: coverage
# merge-multiple: true
# - name: Install Dependencies
# run: uv pip install -r requirements-tests.txt
# - run: ls -la coverage
# - run: coverage combine coverage
# - run: coverage report
# - run: coverage html --title "Coverage for ${{ github.sha }}"
# - name: Store coverage HTML
# uses: actions/upload-artifact@v4
# with:
# name: coverage-html
# path: htmlcov
# include-hidden-files: true

# https://github.com/marketplace/actions/alls-green#why
alls-green: # This job does nothing and is only used for the branch protection
if: always()
needs:
- coverage-combine
- test
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down

0 comments on commit 5259360

Please sign in to comment.