Skip to content

Fix CI

Fix CI #440

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
# JOB: Tests
tests-job:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
#----------------------------------------------
#---- Checkout and install poetry and python
#----------------------------------------------
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
#----------------------------------------------
#---- Install dependencies
#----------------------------------------------
- name: Poetry install
run: poetry install
#----------------------------------------------
#---- Show installation details
#----------------------------------------------
- name: Poetry version
run: poetry --version
- name: Python version in venv
run: poetry run python --version
- name: List files
run: ls -lah
- name: Poetry show
run: poetry show
#----------------------------------------------
#---- Pre-Checks
#----------------------------------------------
- name: Show clock resolution
run: poetry run python tests/system_checks/test_tick_rate.py
- name: Test clocks
run: poetry run python tests/system_checks/test_clocks.py
- name: Test monotonicity
run: poetry run python tests/system_checks/test_monotonic_over_threads.py
#----------------------------------------------
#---- Run tests with coverage report
#----------------------------------------------
- name: 🚀 Run tests with code coverage report
run: poetry run pytest --cov=dictdatabase --cov-report term-missing
#----------------------------------------------
#---- Save coverage artifact
#----------------------------------------------
- name: Debug coverage file
run: ls -lah
- uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
include-hidden-files: true
if-no-files-found: error
path: ".coverage"
# JOB: Coverage Badge
cov-badge-job:
needs: tests-job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
#----------------------------------------------
#---- Download and debug artifact
#----------------------------------------------
- name: Debug workspace
run: ls -lah
- uses: actions/download-artifact@v4
with:
name: coverage-3.12
path: .
- name: Debug downloaded artifact
run: ls -lah
#----------------------------------------------
#---- Generate coverage badge
#----------------------------------------------
- name: Generate Coverage Badge
uses: tj-actions/coverage-badge-py@v2
with:
output: assets/coverage.svg
#----------------------------------------------
#---- Verify and commit changes
#----------------------------------------------
- name: Verify Changed Files
uses: tj-actions/verify-changed-files@v16
id: changed_files
with:
files: assets/coverage.svg
- name: Commit Files
if: steps.changed_files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add assets/coverage.svg
git commit -m "Updated assets/coverage.svg"
- name: Push Changes
if: steps.changed_files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.github_token }}
branch: ${{ github.ref }}