From 204ae862c5f72a7d8c19a3eeebc6b3b2fd444f5c Mon Sep 17 00:00:00 2001 From: iwtba4188 Date: Fri, 8 Dec 2023 14:22:04 +0800 Subject: [PATCH] for testing, squash later --- .github/workflows/smokeshow.yml | 35 +++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 13 ++++++------ requirements-tests.txt | 3 +-- 3 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/smokeshow.yml diff --git a/.github/workflows/smokeshow.yml b/.github/workflows/smokeshow.yml new file mode 100644 index 0000000..1c3629d --- /dev/null +++ b/.github/workflows/smokeshow.yml @@ -0,0 +1,35 @@ +name: Generate Coverage + +on: + workflow_run: + workflows: [Test] + types: [completed] + +jobs: + Smokeshow: + if: ${{ github.event == 'push' && github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - run: pip install smokeshow + + - uses: dawidd6/action-download-artifact@v2.28.0 + with: + workflow: test.yml + commit: ${{ github.event.workflow_run.head_sha }} + + - run: smokeshow upload coverage + env: + SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage} + SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 85 + SMOKESHOW_GITHUB_CONTEXT: Coverage + SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} + SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0357e8f..8125a42 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,10 +38,9 @@ jobs: pip install -r requirements.txt pip install -r requirements-tests.txt - name: Test - run: python -m pytest -n auto tests --cov=. --cov-report=html:coverage --cov-fail-under=80 - - run: smokeshow upload coverage - env: - SMOKESHOW_GITHUB_STATUS_DESCRIPTION: coverage {coverage-percentage} - SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 50 - SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} \ No newline at end of file + run: python -m pytest -n auto tests --cov=. --cov-report=html:coverage --cov-fail-under=85 + - name: Store coverage files + uses: actions/upload-artifact@v3 + with: + name: coverage + path: coverage \ No newline at end of file diff --git a/requirements-tests.txt b/requirements-tests.txt index c5cf74d..df27660 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -2,5 +2,4 @@ pytest==7.4.3 pytest-xdist==3.4.0 pytest-cov==4.1.0 -httpx==0.25.1 -smokeshow==0.4.0 \ No newline at end of file +httpx==0.25.1 \ No newline at end of file