Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrd committed Nov 15, 2024
1 parent e3d6e83 commit 04abf33
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 33 deletions.
72 changes: 46 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,62 @@
name: Tests
on: [push, pull_request]

jobs:

# JOB
# JOB: Tests
tests-job:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
#----------------------------------------------
#---- Checkout and install poetry and python
#----------------------------------------------

- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'

#----------------------------------------------
#---- install dependencies
#---- Install dependencies
#----------------------------------------------

- name: poetry install
- name: Poetry install
run: poetry install

#----------------------------------------------
#---- show installation details
#---- Show installation details
#----------------------------------------------

- name: poetry --version
- name: Poetry version
run: poetry --version
- name: python --version in venv
- name: Python version in venv
run: poetry run python --version
- name: ls -lah
- name: List files
run: ls -lah
- name: poetry show
- name: Poetry show
run: poetry show

#----------------------------------------------
#---- Pre-Checks
#----------------------------------------------

- name: Show clock res
- 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

#----------------------------------------------
#---- Tests
#---- Run tests with coverage report
#----------------------------------------------

- name: 🚀 Run tests with code coverage report
Expand All @@ -64,47 +65,66 @@ jobs:
#----------------------------------------------
#---- Save coverage artifact
#----------------------------------------------
- uses: actions/upload-artifact@v3

- name: Debug coverage file
run: ls -lah
- uses: actions/upload-artifact@v4
with:
name: coverage
path: .coverage
name: coverage-${{ matrix.python-version }}
include-hidden-files: true
if-no-files-found: error
path: ".coverage"

# JOB
# JOB: Coverage Badge
cov-badge-job:
needs: tests-job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

#----------------------------------------------
#---- Coverage badge
#---- Download and debug artifact
#----------------------------------------------
- name: ls-lah

- name: Debug workspace
run: ls -lah

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: coverage
name: coverage-3.12
path: .

- name: Debug downloaded artifact
run: ls -lah

- name: GenerateCoverage Badge
#----------------------------------------------
#---- Generate coverage badge
#----------------------------------------------

- name: Generate Coverage Badge
uses: tj-actions/coverage-badge-py@v2
with:
output: assets/coverage.svg

- name: Verify Changed files
#----------------------------------------------
#---- 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
- 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
- name: Push Changes
if: steps.changed_files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ it.
- **Compression**. Configure if the files should be stored as raw json or as json
compressed with zlib.
- **Fast**. Key-value pairs inside a json file can be accessed quickly and efficiently because the keys are indexed.
- **Tested** with 99%+ coverage.
- **Tested** with 98%+ coverage on Python 3.8 to 3.13.

### Why use DictDataBase
- Your application concurrently reads and writes data from multiple processes or threads.
Expand Down
11 changes: 5 additions & 6 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
alias t := test
alias p := profiler
alias bp := benchmark_parallel
alias bt := benchmark_threaded
alias ba := benchmark_async

default:
@just --list

alias t := test
test:
poetry run pytest --cov=dictdatabase --cov-report term-missing
rm ./.coverage

alias p := profiler
profiler:
poetry run python profiler.py

alias bp := benchmark_parallel
benchmark_parallel:
poetry run python tests/benchmark/run_parallel.py

alias bt := benchmark_threaded
benchmark_threaded:
poetry run python tests/benchmark/run_threaded.py

alias ba := benchmark_async
benchmark_async:
poetry run python tests/benchmark/run_async.py

0 comments on commit 04abf33

Please sign in to comment.