Skip to content

Commit 7a12e11

Browse files
authored
infra: enable pydantic version tests (#5)
* add workflow * enable in CI
1 parent d7eefc3 commit 7a12e11

File tree

3 files changed

+87
-1
lines changed

3 files changed

+87
-1
lines changed

.github/scripts/check_diff.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
{"working-directory": "libs/community", "python-version": py_v}
4747
for py_v in ["3.9", "3.12"]
4848
],
49+
"test-pydantic": [
50+
{
51+
"working-directory": "libs/community",
52+
"python-version": "3.11",
53+
"pydantic-version": pydantic_version,
54+
}
55+
for pydantic_version in ["2.7.0", "2.11.0"]
56+
],
4957
}
5058
for key, value in outputs.items():
5159
json_output = json.dumps(value)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: test pydantic intermediate versions
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
working-directory:
7+
required: true
8+
type: string
9+
description: "From which folder this pipeline executes"
10+
python-version:
11+
required: false
12+
type: string
13+
description: "Python version to use"
14+
default: "3.11"
15+
pydantic-version:
16+
required: true
17+
type: string
18+
description: "Pydantic version to test."
19+
20+
env:
21+
UV_FROZEN: "true"
22+
UV_NO_SYNC: "true"
23+
24+
jobs:
25+
build:
26+
defaults:
27+
run:
28+
working-directory: ${{ inputs.working-directory }}
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 20
31+
name: "make test # pydantic: ~=${{ inputs.pydantic-version }}, python: ${{ inputs.python-version }}, "
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up Python ${{ inputs.python-version }} + uv
36+
uses: "./.github/actions/uv_setup"
37+
with:
38+
python-version: ${{ inputs.python-version }}
39+
40+
- name: Install dependencies
41+
shell: bash
42+
run: uv sync --group test
43+
44+
- name: Overwrite pydantic version
45+
shell: bash
46+
run: VIRTUAL_ENV=.venv uv pip install pydantic~=${{ inputs.pydantic-version }}
47+
48+
- name: Run core tests
49+
shell: bash
50+
run: |
51+
make test
52+
53+
- name: Ensure the tests did not create any additional files
54+
shell: bash
55+
run: |
56+
set -eu
57+
58+
STATUS="$(git status)"
59+
echo "$STATUS"
60+
61+
# grep will exit non-zero if the target message isn't found,
62+
# and `set -e` above will cause the step to fail.
63+
echo "$STATUS" | grep 'nothing to commit, working tree clean'

.github/workflows/check_diffs.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
dirs-to-lint: ${{ steps.set-matrix.outputs.dirs-to-lint }}
3838
dirs-to-test: ${{ steps.set-matrix.outputs.dirs-to-test }}
3939
extended-tests: ${{ steps.set-matrix.outputs.extended-tests }}
40+
test-pydantic: ${{ steps.set-matrix.outputs.test-pydantic }}
4041
lint:
4142
name: cd ${{ matrix.working-directory }}
4243
needs: [ build ]
@@ -61,6 +62,20 @@ jobs:
6162
working-directory: ${{ matrix.working-directory }}
6263
secrets: inherit
6364

65+
test-pydantic:
66+
name: cd ${{ matrix.job-configs.working-directory }}
67+
needs: [ build ]
68+
if: ${{ needs.build.outputs.test-pydantic != '[]' }}
69+
strategy:
70+
matrix:
71+
job-configs: ${{ fromJson(needs.build.outputs.test-pydantic) }}
72+
fail-fast: false
73+
uses: ./.github/workflows/_test_pydantic.yml
74+
with:
75+
working-directory: ${{ matrix.job-configs.working-directory }}
76+
pydantic-version: ${{ matrix.job-configs.pydantic-version }}
77+
secrets: inherit
78+
6479
compile-integration-tests:
6580
name: cd ${{ matrix.working-directory }}
6681
needs: [ build ]
@@ -118,7 +133,7 @@ jobs:
118133
119134
ci_success:
120135
name: "CI Success"
121-
needs: [build, lint, test, compile-integration-tests]
136+
needs: [build, lint, test, test-pydantic, compile-integration-tests, extended-tests]
122137
if: |
123138
always()
124139
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)