change docker version #56
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: Run tests | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| pull_request: | |
| branches: [ main ] | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| env: | |
| COVERAGE_REPORT_PATH: htmlcov | |
| jobs: | |
| CheckCoverage: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.9", "3.10", "3.11"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Start test database | |
| run: ./test/start_test_db.sh | |
| - name: Run tests with coverage | |
| run: | | |
| echo "COVERAGE=$(uv run pytest --cov=src --cov-report=term-missing --cov-report=html | tee /dev/stderr | grep TOTAL | awk '{print $4}')" >> $GITHUB_ENV | |
| - name: Stop test database | |
| if: always() | |
| run: ./test/stop_test_db.sh | |
| - name: Upload coverage artifact | |
| if: matrix.python-version == '3.10' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: ${{ env.COVERAGE_REPORT_PATH }} | |
| - name: Generate coverage badge | |
| if: matrix.python-version == '3.10' | |
| run: | | |
| COVERAGE_NUM=$(echo ${{ env.COVERAGE }} | sed 's/%//') | |
| if (( $(echo "$COVERAGE_NUM >= 90" | bc -l) )); then | |
| COLOR="green" | |
| elif (( $(echo "$COVERAGE_NUM >= 75" | bc -l) )); then | |
| COLOR="yellow" | |
| elif (( $(echo "$COVERAGE_NUM >= 60" | bc -l) )); then | |
| COLOR="orange" | |
| else | |
| COLOR="red" | |
| fi | |
| echo "BADGE_COLOR=$COLOR" >> $GITHUB_ENV | |
| - name: Create coverage badge | |
| if: matrix.python-version == '3.10' | |
| uses: emibcn/[email protected] | |
| with: | |
| label: 'Coverage' | |
| status: '${{ env.COVERAGE }}' | |
| color: '${{ env.BADGE_COLOR }}' | |
| path: 'test/coverage-badge.svg' | |
| - name: Commit coverage badge | |
| if: matrix.python-version == '3.10' && github.event_name == 'push' | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add test/coverage-badge.svg | |
| git diff --staged --quiet || git commit -m "Update coverage badge" | |
| git push |