test: remove test for coverage test #29
Workflow file for this run
This file contains hidden or 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: Test Workflow with Coverage | |
| on: | |
| push: | |
| branches: [main, dev, demo] | |
| paths: | |
| - 'code/**' | |
| - 'pyproject.toml' | |
| - 'package.json' | |
| - 'pytest.ini' | |
| - '.github/workflows/tests.yml' | |
| pull_request: | |
| branches: [main, dev, demo] | |
| paths: | |
| - 'code/**' | |
| - 'pyproject.toml' | |
| - 'package.json' | |
| - 'pytest.ini' | |
| - '.github/workflows/tests.yml' | |
| types: | |
| - opened | |
| - ready_for_review | |
| - reopened | |
| - synchronize | |
| workflow_call: | |
| merge_group: | |
| jobs: | |
| test_package: | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Poetry | |
| run: pip install poetry | |
| - name: Setup python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| architecture: x64 | |
| cache: 'poetry' | |
| - name: Install dependencies through poetry | |
| run: | | |
| poetry install | |
| - name: Get coverage artifact ID | |
| id: coverage-artifact | |
| uses: actions/github-script@v8 | |
| if: github.event_name == 'pull_request' | |
| with: | |
| script: | | |
| const workflows = await github.rest.actions.listRepoWorkflows({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| const workflowId = workflows.data.workflows.find(workflow => workflow.name === "${{ github.workflow }}")?.id; | |
| if (!workflowId) return ""; | |
| const workflowRuns = await github.rest.actions.listWorkflowRuns({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: workflowId, | |
| branch: "${{ github.base_ref }}", | |
| event: "push", | |
| status: "success", | |
| }); | |
| return workflowRuns.data.workflow_runs[0]?.id ?? ""; | |
| result-encoding: string | |
| retries: 3 | |
| - name: Download main coverage artifact | |
| uses: actions/download-artifact@v5 | |
| if: github.event_name == 'pull_request' && steps.coverage-artifact.outputs.result != '' | |
| continue-on-error: true # There is a chance that the artifact doesn't exist, or has expired | |
| with: | |
| name: coverage | |
| path: "${{ github.workspace }}/coverage-main" | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| run-id: ${{ steps.coverage-artifact.outputs.result }} | |
| - name: Get coverage from main | |
| id: coverage-value | |
| run: | | |
| MIN_COVERAGE=90 # Set a minimum baseline | |
| if [[ -f "./coverage-main/coverage.xml" ]]; then | |
| MAIN_COVERAGE=$(grep -m 1 "<coverage" "./coverage-main/coverage.xml" | sed -E 's/.*line-rate="([^"]*)".*/\1/') | |
| MAIN_COVERAGE=$(awk "BEGIN {print int($MAIN_COVERAGE * 100)}") | |
| MIN_COVERAGE=$(( MAIN_COVERAGE > MIN_COVERAGE ? MAIN_COVERAGE : MIN_COVERAGE )) | |
| fi | |
| echo "MIN_COVERAGE=$MIN_COVERAGE" >> "$GITHUB_OUTPUT" | |
| - name: Run Python Tests | |
| run: make python-test optional_args="--junitxml=coverage-junit.xml --cov=code --cov-report=term-missing --cov-report=xml:coverage.xml --cov-fail-under=${{ steps.coverage-value.outputs.MIN_COVERAGE }} ./code/tests" | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: coverage | |
| path: | | |
| coverage-junit.xml | |
| coverage.xml | |
| if-no-files-found: error | |
| - name: Setup node | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: "npm" | |
| cache-dependency-path: "code/frontend/package-lock.json" | |
| - name: Run frontend unit tests | |
| run: make unittest-frontend | |
| - name: Lint | |
| run: make lint |