-
Notifications
You must be signed in to change notification settings - Fork 12
144 lines (115 loc) · 4.41 KB
/
test.yml
File metadata and controls
144 lines (115 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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"]
steps:
#----------------------------------------------
#---- Checkout and install uv and python
#----------------------------------------------
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
#----------------------------------------------
#---- Install dependencies
#----------------------------------------------
- name: uv install
run: uv sync --all-extras --dev
#----------------------------------------------
#---- Show installation details
#----------------------------------------------
- name: uv --version
run: uv --version
- name: uv run python --version
run: uv run python --version
- name: ls -lah
run: ls -lah
- name: uv tree
run: uv tree
#----------------------------------------------
#---- Linting and Static Analysis
#----------------------------------------------
- name: 🔎 Run Ruff
run: uv run ruff check . # Or 'ruff format --check .' if you want formatting checks
- name: 🐍 Mypy Static Type Checker
run: uv run mypy .
#----------------------------------------------
#---- Pre-Checks
#----------------------------------------------
- name: Show clock resolution
run: uv run python tests/system_checks/test_tick_rate.py
- name: Test clocks
run: uv run python tests/system_checks/test_clocks.py
- name: Test monotonicity
run: uv run python tests/system_checks/test_monotonic_over_threads.py
#----------------------------------------------
#---- Run tests with coverage report
#----------------------------------------------
- name: 🚀 Run tests with code coverage report
run: uv 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:
# Only run this job on push events to the main branch, after tests succeed
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.tests-job.result == 'success'
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@v17
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 }}