4242 helm : ${{ steps.changes.outputs.helm_all }}
4343 python : ${{ steps.changes.outputs.python_all }}
4444 yaml : ${{ steps.changes.outputs.yaml_all }}
45- poetry_files : ${{ steps.changes.outputs.poetry_files }}
45+ uv_files : ${{ steps.changes.outputs.uv_files }}
4646 github_workflows : ${{ steps.changes.outputs.github_workflows }}
4747 steps :
4848 - name : " Check out repository code"
@@ -71,18 +71,26 @@ jobs:
7171
7272 python-lint :
7373 if : needs.files-changed.outputs.python == 'true'
74- needs : ["files-changed"]
74+ needs : ["files-changed", "prepare-environment" ]
7575 runs-on : " ubuntu-latest"
7676 timeout-minutes : 5
7777 steps :
7878 - name : " Check out repository code"
79- uses : " actions/checkout@v6"
80- - name : " Setup environment"
81- run : " pip install ruff==0.11.0"
79+ uses : " actions/checkout@v5"
80+ - name : Set up Python
81+ uses : actions/setup-python@v6
82+ with :
83+ python-version : " 3.12"
84+ - name : Install UV
85+ uses : astral-sh/setup-uv@v7
86+ with :
87+ version : " ${{ needs.prepare-environment.outputs.UV_VERSION }}"
88+ - name : Install dependencies
89+ run : uv sync --group lint
8290 - name : " Linting: ruff check"
83- run : " ruff check ."
91+ run : " uv run ruff check ."
8492 - name : " Linting: ruff format"
85- run : " ruff format --check --diff ."
93+ run : " uv run ruff format --check --diff ."
8694
8795
8896 markdown-lint :
@@ -129,7 +137,7 @@ jobs:
129137 !contains(needs.*.result, 'failure') &&
130138 !contains(needs.*.result, 'cancelled') &&
131139 needs.files-changed.outputs.documentation == 'true'
132- needs : ["files-changed", "yaml-lint", "python-lint"]
140+ needs : ["prepare-environment", " files-changed", "yaml-lint", "python-lint"]
133141 runs-on : " ubuntu-22.04"
134142 timeout-minutes : 5
135143 steps :
@@ -145,10 +153,18 @@ jobs:
145153 cache-dependency-path : docs/package-lock.json
146154 - name : " Install dependencies"
147155 run : npm install
148- - name : " Setup Python environment"
149- run : " pip install invoke"
156+ - name : Set up Python
157+ uses : actions/setup-python@v6
158+ with :
159+ python-version : " 3.12"
160+ - name : Install UV
161+ uses : astral-sh/setup-uv@v7
162+ with :
163+ version : " ${{ needs.prepare-environment.outputs.UV_VERSION }}"
164+ - name : Install dependencies
165+ run : uv sync --all-groups --all-extras
150166 - name : " Build docs website"
151- run : " invoke docs"
167+ run : " uv run invoke docs"
152168
153169 validate-generated-documentation :
154170 if : |
@@ -168,17 +184,14 @@ jobs:
168184 uses : actions/setup-python@v6
169185 with :
170186 python-version : " 3.12"
171- - name : " Setup Python environment"
172- run : |
173- pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
174- poetry config virtualenvs.create true --local
175- poetry env use 3.12
176- - name : " Install dependencies"
177- run : " poetry install --no-interaction --no-ansi --extras ctl"
178- - name : " Setup environment"
179- run : " poetry run pip install invoke"
180- - name : " Validate generated documentation"
181- run : " poetry run invoke docs-validate"
187+ - name : Install UV
188+ uses : astral-sh/setup-uv@v7
189+ with :
190+ version : " ${{ needs.prepare-environment.outputs.UV_VERSION }}"
191+ - name : Install dependencies
192+ run : uv sync --all-groups --all-extras
193+ - name : Validate generated documentation
194+ run : uv run invoke docs-validate
182195
183196 validate-documentation-style :
184197 if : |
@@ -212,7 +225,6 @@ jobs:
212225 strategy :
213226 matrix :
214227 python-version :
215- - " 3.9"
216228 - " 3.10"
217229 - " 3.11"
218230 - " 3.12"
@@ -232,24 +244,20 @@ jobs:
232244 uses : actions/setup-python@v6
233245 with :
234246 python-version : ${{ matrix.python-version }}
235- - name : " Setup environment"
236- run : |
237- pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }} --python python${{ matrix.python-version }}
238- poetry config virtualenvs.create true --local
239- pip install invoke codecov
240- - name : " Install tomli for Python < 3.11"
241- if : matrix.python-version == '3.9' || matrix.python-version == '3.10'
242- run : |
243- pip install tomli
244- - name : " Install Package"
245- run : " poetry install --all-extras"
246- - name : " Mypy Tests"
247- run : " poetry run mypy --show-error-codes infrahub_sdk/"
248- - name : " Unit Tests"
249- run : " poetry run pytest --cov infrahub_sdk tests/unit/"
247+ - name : Install UV
248+ uses : astral-sh/setup-uv@v7
249+ with :
250+ version : " ${{ needs.prepare-environment.outputs.UV_VERSION }}"
251+ python-version : ${{ matrix.python-version }}
252+ - name : Install dependencies
253+ run : uv sync --all-groups --all-extras
254+ - name : Mypy Tests
255+ run : uv run mypy --show-error-codes infrahub_sdk/
256+ - name : Unit Tests
257+ run : uv run pytest --cov infrahub_sdk tests/unit/
250258 - name : " Upload coverage to Codecov"
251259 run : |
252- codecov --flags python-${{ matrix.python-version }}
260+ uv run codecov --flags python-${{ matrix.python-version }}
253261 env :
254262 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
255263
@@ -259,11 +267,10 @@ jobs:
259267 - name : " Report coverage for pytest-plugin"
260268 if : matrix.python-version == '3.12'
261269 run : |
262- source $(poetry env info --path)/bin/activate
263- coverage run --source=infrahub_sdk -m pytest tests/unit/pytest_plugin
264- coverage report -m
265- coverage xml
266- codecov --flags python-filler-${{ matrix.python-version }}
270+ uv run coverage run --source=infrahub_sdk -m pytest tests/unit/pytest_plugin
271+ uv run coverage report -m
272+ uv run coverage xml
273+ uv run codecov --flags python-filler-${{ matrix.python-version }}
267274 env :
268275 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
269276
@@ -289,19 +296,17 @@ jobs:
289296 run : |
290297 RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/')
291298 echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
292- - name : " Setup environment"
293- run : |
294- pipx install poetry==${{ needs.prepare-environment.outputs.POETRY_VERSION }}
295- poetry config virtualenvs.create true --local
296- pip install invoke codecov
297- - name : " Install Package"
298- run : " poetry install --all-extras"
299- - name : " Integration Tests"
300- run : |
301- poetry run pytest --cov infrahub_sdk tests/integration/
299+ - name : Install UV
300+ uses : astral-sh/setup-uv@v7
301+ with :
302+ version : " ${{ needs.prepare-environment.outputs.UV_VERSION }}"
303+ - name : Install dependencies
304+ run : uv sync --all-groups --all-extras
305+ - name : Integration Tests
306+ run : uv run pytest --cov infrahub_sdk tests/integration/
302307 - name : " Upload coverage to Codecov"
303308 run : |
304- codecov --flags integration-tests
309+ uv run codecov --flags integration-tests
305310 env :
306311 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
307312
0 commit comments