Skip to content

Commit

Permalink
馃敡 Add Smokeshow to replace Codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Nov 3, 2022
1 parent fddebe3 commit 222457a
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/smokeshow.yml
@@ -0,0 +1,35 @@
name: Smokeshow

on:
workflow_run:
workflows: [Test]
types: [completed]

permissions:
statuses: write

jobs:
smokeshow:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v4
with:
python-version: '3.9'

- run: pip install smokeshow

- uses: dawidd6/action-download-artifact@v2
with:
workflow: test.yml
commit: ${{ github.event.workflow_run.head_sha }}

- run: smokeshow upload coverage-html
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100
SMOKESHOW_GITHUB_CONTEXT: coverage
SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }}
40 changes: 38 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -31,7 +31,43 @@ jobs:
run: pip install -e .[all,dev,doc,test]
- name: Lint
run: bash scripts/lint.sh
- run: mkdir coverage
- name: Test
run: bash scripts/test.sh
- name: Upload coverage
uses: codecov/codecov-action@v3
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
- name: store coverage files
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage
coverage-combine:
needs: [test]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: get coverage files
uses: actions/download-artifact@v3
with:
name: coverage
path: coverage

- run: pip install coverage[toml]

- run: ls -la coverage
- run: coverage combine coverage
- run: coverage report
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"

- name: Store coverage html
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: htmlcov
1 change: 1 addition & 0 deletions pyproject.toml
Expand Up @@ -155,6 +155,7 @@ source = [
"tests",
"fastapi"
]
context = '${CONTEXT}'

[tool.coverage.report]
exclude_lines = [
Expand Down
1 change: 0 additions & 1 deletion scripts/test-cov-html.sh
Expand Up @@ -6,5 +6,4 @@ set -x
bash scripts/test.sh ${@}
coverage combine
coverage report --show-missing
coverage xml
coverage html

0 comments on commit 222457a

Please sign in to comment.