]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
👷 Move from Codecov to Smokeshow (#486)
authorSebastián Ramírez <tiangolo@gmail.com>
Fri, 4 Nov 2022 22:01:37 +0000 (23:01 +0100)
committerGitHub <noreply@github.com>
Fri, 4 Nov 2022 22:01:37 +0000 (22:01 +0000)
.github/workflows/smokeshow.yml [new file with mode: 0644]
.github/workflows/test.yml
README.md
docs/index.md
pyproject.toml
scripts/test-cov-html.sh [deleted file]
scripts/test.sh

diff --git a/.github/workflows/smokeshow.yml b/.github/workflows/smokeshow.yml
new file mode 100644 (file)
index 0000000..606633a
--- /dev/null
@@ -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 }}
index bceec7e71ff9dab079cce3dc09b8f659442f1b36..03c55df422775bebe02ef0f253010a3fe91e4688 100644 (file)
@@ -56,7 +56,43 @@ jobs:
       - name: Lint
         if: ${{ matrix.python-version != '3.6.15' }}
         run: python -m poetry run bash scripts/lint.sh
+      - run: mkdir coverage
       - name: Test
         run: python -m poetry 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
index 5a63c9da447ceca3f023656b0c05a2842f68dda7..5721f1cdb0c3fca170cc1c09e4f265c999c96133 100644 (file)
--- a/README.md
+++ b/README.md
@@ -11,9 +11,8 @@
 <a href="https://github.com/tiangolo/sqlmodel/actions?query=workflow%3APublish" target="_blank">
     <img src="https://github.com/tiangolo/sqlmodel/workflows/Publish/badge.svg" alt="Publish">
 </a>
-<a href="https://codecov.io/gh/tiangolo/sqlmodel" target="_blank">
-    <img src="https://img.shields.io/codecov/c/github/tiangolo/sqlmodel?color=%2334D058" alt="Coverage">
-</a>
+<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/tiangolo/sqlmodel" target="_blank">
+    <img src="https://coverage-badge.samuelcolvin.workers.dev/tiangolo/sqlmodel.svg" alt="Coverage">
 <a href="https://pypi.org/project/sqlmodel" target="_blank">
     <img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
 </a>
index 5a63c9da447ceca3f023656b0c05a2842f68dda7..5721f1cdb0c3fca170cc1c09e4f265c999c96133 100644 (file)
@@ -11,9 +11,8 @@
 <a href="https://github.com/tiangolo/sqlmodel/actions?query=workflow%3APublish" target="_blank">
     <img src="https://github.com/tiangolo/sqlmodel/workflows/Publish/badge.svg" alt="Publish">
 </a>
-<a href="https://codecov.io/gh/tiangolo/sqlmodel" target="_blank">
-    <img src="https://img.shields.io/codecov/c/github/tiangolo/sqlmodel?color=%2334D058" alt="Coverage">
-</a>
+<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/tiangolo/sqlmodel" target="_blank">
+    <img src="https://coverage-badge.samuelcolvin.workers.dev/tiangolo/sqlmodel.svg" alt="Coverage">
 <a href="https://pypi.org/project/sqlmodel" target="_blank">
     <img src="https://img.shields.io/pypi/v/sqlmodel?color=%2334D058&label=pypi%20package" alt="Package version">
 </a>
index 3e0dd9b25a71646b9c69afcfc1b0f15cfad6e3a9..e3b1d3c2795ac2bfc5303841faef0fa9318be3af 100644 (file)
@@ -67,6 +67,7 @@ source = [
     "tests",
     "sqlmodel"
 ]
+context = '${CONTEXT}'
 
 [tool.coverage.report]
 exclude_lines = [
diff --git a/scripts/test-cov-html.sh b/scripts/test-cov-html.sh
deleted file mode 100755 (executable)
index b15445f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-set -x
-
-bash ./scripts/test.sh
-coverage html
index 7fce865bd6459d4bdf335bb70e8910503ae911d9..9b758bdbdfc669c64a0bd2a34e3ba85f23750ac6 100755 (executable)
@@ -6,4 +6,4 @@ set -x
 coverage run -m pytest tests
 coverage combine
 coverage report --show-missing
-coverage xml
+coverage html