Skip to content

Commit eedc3e2

Browse files
tmp
1 parent 85524fc commit eedc3e2

71 files changed

Lines changed: 5509 additions & 2493 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env renamed to .env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ MONGO_DSN=mongodb://root:root@localhost:27017/test?authSource=admin
3636

3737
# OPENSEARCH
3838
OPENSEARCH_HOSTS=localhost:9200
39+
40+
# SONAR
41+
SONAR_ORGANIZATION=user
42+
SONAR_PROJECT_KEY=fast-healthchecks
43+
SONAR_TOKEN=sqp_XXX
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Setup test environment
2+
description: Install uv, make (Windows), Python for test jobs
3+
4+
inputs:
5+
python-version:
6+
required: true
7+
8+
runs:
9+
using: composite
10+
steps:
11+
- name: Install uv
12+
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b
13+
with:
14+
enable-cache: true
15+
cache-dependency-glob: "pyproject.toml"
16+
github-token: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Add .local/bin to Windows PATH
19+
if: runner.os == 'Windows'
20+
shell: bash
21+
run: echo "$USERPROFILE/.local/bin" >> $GITHUB_PATH
22+
23+
- name: Install make (Windows)
24+
if: runner.os == 'Windows'
25+
run: |
26+
choco install make -y
27+
echo "C:\ProgramData\chocolatey\bin" >> $env:GITHUB_PATH
28+
29+
- name: Set up Python
30+
run: uv python install ${{ inputs.python-version }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Upload coverage to Codecov
2+
description: Generate coverage XML and upload to Codecov
3+
4+
inputs:
5+
flags:
6+
required: true
7+
name:
8+
required: false
9+
default: ""
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Generate coverage XML for Codecov
15+
run: uv run coverage xml
16+
17+
- name: Upload coverage to Codecov
18+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
19+
with:
20+
env_vars: OS,PYTHON
21+
fail_ci_if_error: true
22+
flags: ${{ inputs.flags }}
23+
name: ${{ inputs.name }}
24+
verbose: true

.github/workflows/1_test.yml

Lines changed: 121 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ name: Tests
22

33
on:
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/**"
@@ -14,27 +16,42 @@ on:
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

1828
concurrency:
1929
group: check-${{ github.ref }}
2030
cancel-in-progress: true
2131

32+
permissions:
33+
contents: read
34+
2235
jobs:
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

.github/workflows/2_bump.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,60 @@ name: Bump version
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
increment:
7+
description: "Version increment type"
8+
required: false
9+
default: ""
10+
type: choice
11+
options:
12+
- ""
13+
- "PATCH"
14+
- "MINOR"
15+
- "MAJOR"
16+
release_notes:
17+
description: "Custom release notes (overrides CHANGELOG.md)"
18+
required: false
19+
type: string
20+
21+
permissions:
22+
contents: write
523

624
jobs:
725
bump-version:
8-
if: "!startsWith(github.event.head_commit.message, 'bump:')"
26+
if: "github.event.head_commit == null || !startsWith(github.event.head_commit.message, 'bump:')"
927
runs-on: ubuntu-latest
1028
name: "Bump version and create changelog with commitizen"
1129
steps:
1230
- name: Check out
13-
uses: actions/checkout@v5.0.0
31+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
1432
with:
1533
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
1634
fetch-depth: 0
1735

1836
- name: Create bump and changelog
19-
uses: commitizen-tools/commitizen-action@0.24.0
37+
id: bump
38+
uses: commitizen-tools/commitizen-action@2e8226b3e7e141ae28de9942957f267eb5d68fb6
2039
with:
2140
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
41+
increment: ${{ inputs.increment }}
42+
43+
- name: Prepare release notes
44+
id: release_notes
45+
run: |
46+
if [ -n "$RELEASE_NOTES" ]; then
47+
printf '%s' "$RELEASE_NOTES" > release_body.md
48+
echo "path=release_body.md" >> "$GITHUB_OUTPUT"
49+
else
50+
echo "path=CHANGELOG.md" >> "$GITHUB_OUTPUT"
51+
fi
52+
env:
53+
RELEASE_NOTES: ${{ inputs.release_notes }}
2254

2355
- name: Release
24-
uses: softprops/action-gh-release@v2.3.3
56+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b
2557
with:
26-
body_path: "CHANGELOG.md"
27-
tag_name: ${{ env.REVISION }}
58+
tag_name: ${{ steps.bump.outputs.version }}
59+
body_path: ${{ steps.release_notes.outputs.path }}
2860
env:
2961
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/3_docs.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Docs
22

3+
permissions:
4+
contents: write
5+
36
on:
47
push:
58
tags:
@@ -15,10 +18,14 @@ jobs:
1518
if: github.event.repository.fork == false
1619
steps:
1720

18-
- uses: actions/checkout@v5.0.0
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
1922

2023
- name: Install uv
21-
uses: astral-sh/setup-uv@v6.7.0
24+
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b
25+
with:
26+
enable-cache: true
27+
cache-dependency-glob: "pyproject.toml"
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
2229

2330
- name: Set up Python 3.13
2431
run: uv python install 3.13

0 commit comments

Comments
 (0)