@@ -2,8 +2,10 @@ name: Tests
22
33on :
44 workflow_dispatch :
5+ schedule :
6+ - cron : " 0 3 * * *"
57 push :
6- branches : ["main"]
8+ branches : ["main", "dev" ]
79 tags-ignore : ["**"]
810 paths :
911 - " examples/**"
1416 - " requirements.txt"
1517 - " uv.lock"
1618 pull_request :
19+ paths :
20+ - " examples/**"
21+ - " fast_healthchecks/**"
22+ - " tests/**"
23+ - " .pre-commit-config.yaml"
24+ - " pyproject.toml"
25+ - " requirements.txt"
26+ - " uv.lock"
1727
1828concurrency :
1929 group : check-${{ github.ref }}
2030 cancel-in-progress : true
2131
32+ permissions :
33+ contents : read
34+
2235jobs :
2336
2437 pre-commit :
2538 runs-on : ubuntu-latest
2639 if : github.event.repository.fork == false
2740 steps :
2841
29- - uses : actions/checkout@v5.0.0
42+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
3043
3144 - name : Set up Python 3.10
32- uses : actions/setup-python@v6.0.0
45+ uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
3346 with :
3447 python-version : ' 3.10'
3548
3649 - name : Install uv
37- uses : astral-sh/setup-uv@v6.7.0
50+ uses : astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b
51+ with :
52+ enable-cache : true
53+ cache-dependency-glob : " pyproject.toml"
54+ github-token : ${{ secrets.GITHUB_TOKEN }}
3855
3956 - name : Install the project
4057 run : uv sync --all-extras --dev
@@ -44,11 +61,69 @@ jobs:
4461 env :
4562 SKIP : " detect-aws-credentials,no-commit-to-branch"
4663
64+ audit :
65+ needs : [pre-commit]
66+ name : pip-audit
67+ runs-on : ubuntu-latest
68+ if : github.event.repository.fork == false
69+ steps :
70+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
71+
72+ - name : Install uv
73+ uses : astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b
74+ with :
75+ enable-cache : true
76+ cache-dependency-glob : " pyproject.toml"
77+ github-token : ${{ secrets.GITHUB_TOKEN }}
78+
79+ - name : Set up Python 3.10
80+ run : uv python install 3.10
81+
82+ - name : Install project dependencies
83+ run : uv sync --group=dev --all-extras
84+
85+ - name : Run pip-audit
86+ run : uv run pip-audit
87+
88+ imports-tests :
89+ needs : [pre-commit]
90+ name : imports ${{ matrix.python-version }} on ${{ matrix.os }}
91+ runs-on : ${{ matrix.os }}
92+ if : github.event.repository.fork == false
93+ strategy :
94+ fail-fast : false
95+ matrix :
96+ python-version :
97+ - " 3.13"
98+ - " 3.12"
99+ - " 3.11"
100+ - " 3.10"
101+ os :
102+ - ubuntu-latest
103+ - windows-latest
104+ env :
105+ PYTHON : ${{ matrix.python-version }}
106+ steps :
107+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
108+
109+ - uses : ./.github/actions/setup-test-env
110+ with :
111+ python-version : ${{ matrix.python-version }}
112+
113+ - name : Run Imports Tests
114+ run : make tests-imports
115+
116+ - uses : ./.github/actions/upload-coverage
117+ with :
118+ flags : imports
119+
47120 unit-tests :
48121 needs : [pre-commit]
49- name : test with ${{ matrix.python-version }} on ${{ matrix.os }} with ${{ matrix.pydantic-version }}
122+ name : unit ${{ matrix.python-version }} on ${{ matrix.os }}
50123 runs-on : ${{ matrix.os }}
51124 if : github.event.repository.fork == false
125+ env :
126+ PYTHON : ${{ matrix.python-version }}
52127 strategy :
53128 fail-fast : false
54129 matrix :
@@ -57,60 +132,61 @@ jobs:
57132 - " 3.12"
58133 - " 3.11"
59134 - " 3.10"
60- pydantic-version :
61- - " pydantic-v1"
62- - " pydantic-v2"
63135 os :
64136 - ubuntu-latest
65- # - macos-latest
66137 - windows-latest
67138
68139 steps :
69- - uses : actions/checkout@v5.0.0
140+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
70141 with :
71142 fetch-depth : 0
72- - name : Install the latest version of uv
73143
74- uses : astral-sh/ setup-uv@v6.7.0
144+ - uses : ./.github/actions/ setup-test-env
75145 with :
76- enable-cache : true
77- cache-dependency-glob : " pyproject.toml"
78- github-token : ${{ secrets.GITHUB_TOKEN }}
146+ python-version : ${{ matrix.python-version }}
79147
80- - name : Add .local/bin to Windows PATH
81- if : runner.os == 'Windows'
82- shell : bash
83- run : echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
148+ - name : Install project dependencies
149+ run : uv sync --group=dev --all-extras
84150
85- - name : Set up Python ${{ matrix.python-version }}
86- run : uv python install ${{ matrix.python-version }}
151+ - name : Run Unit Tests
152+ run : make tests-unit
87153
88- - name : Run Imports Tests
89- run : |
90- uv sync
91- uv pip install pytest pytest-asyncio pytest-cov greenlet
92- uv run pytest --cov --cov-append -m 'imports' tests/unit/test_imports.py
93- uv sync --group=dev --all-extras
154+ - uses : ./.github/actions/upload-coverage
155+ with :
156+ flags : unittests
157+ name : codecov-umbrella
94158
95- - name : Install Pydantic v1
96- if : matrix.pydantic-version == 'pydantic-v1'
97- run : uv pip install "pydantic>=1.10.23,<2.0.0"
159+ integration-tests :
160+ needs : [pre-commit]
161+ name : integration ${{ matrix.python-version }} on ${{ matrix.os }}
162+ runs-on : ${{ matrix.os }}
163+ if : github.event.repository.fork == false && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
164+ strategy :
165+ fail-fast : false
166+ matrix :
167+ python-version :
168+ - " 3.13"
169+ - " 3.12"
170+ - " 3.11"
171+ - " 3.10"
172+ os :
173+ - ubuntu-latest
174+ - windows-latest
175+ env :
176+ PYTHON : ${{ matrix.python-version }}
177+ steps :
178+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
98179
99- - name : Install Pydantic v2
100- if : matrix.pydantic-version == 'pydantic-v2'
101- run : uv pip install "pydantic>=2.11.9,<3.0.0"
180+ - uses : ./.github/actions/setup-test-env
181+ with :
182+ python-version : ${{ matrix.python-version }}
102183
103- - name : Run Unit Tests
104- run : |
105- uv run pytest --cov --cov-append -m 'unit'
106- uv run coverage xml
184+ - name : Prepare environment for Docker Compose
185+ run : cp .env.example .env
186+
187+ - name : Run integration tests
188+ run : make tests-integration
107189
108- - name : Upload coverage to Codecov
109- uses : codecov/codecov-action@v5.5.1
190+ - uses : ./.github/actions/upload-coverage
110191 with :
111- token : ${{ secrets.CODECOV_TOKEN }}
112- env_vars : OS,PYTHON
113- fail_ci_if_error : true
114- flags : unittests
115- name : codecov-umbrella
116- verbose : true
192+ flags : integration
0 commit comments