Skip to content

Commit f8050d2

Browse files
authored
Enable build for all packages and update nox to use uv backend (#247)
* Enable build for all packages and update nox to use uv backend * Add GH action to run pytest on PRs * run pytest on multiple versions
1 parent 7b7b95f commit f8050d2

File tree

3 files changed

+67
-9
lines changed

3 files changed

+67
-9
lines changed

.github/workflows/pytest-pr.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Run Pytest on PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
test:
12+
name: test on ${{ matrix.python-version }}
13+
runs-on: ubuntu-latest
14+
continue-on-error: true
15+
timeout-minutes: 5
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: astral-sh/setup-uv@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
enable-cache: true
27+
cache-suffix: test
28+
29+
- run: uv sync --all-extras --all-packages
30+
- run: uv run pytest

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: astral-sh/setup-uv@caf0cab7a618c569241d31dcd442f54681755d39 # astral-sh/setup-uv@v3
4040

4141
- name: Build artifacts
42-
run: uv build
42+
run: uv build --all
4343

4444
- name: Publish artifacts to PyPI Test
4545
if: inputs.deploy-to == 'PypiTest'

noxfile.py

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,52 @@
11
import nox
22

3-
nox.options.default_venv_backend = "uv|venv"
3+
nox.options.default_venv_backend = "uv"
44

55

6-
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"])
6+
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"], venv_backend="uv")
77
def run_cli(session):
88
"""Make sure the CLI runs correctly"""
9-
session.install(".")
9+
session.run_install(
10+
"uv",
11+
"sync",
12+
f"--python={session.virtualenv.location}",
13+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
14+
)
1015
session.run("dbt-autofix", "--help")
1116

1217

13-
@nox.session(python=["3.13"])
18+
@nox.session(python=["3.13"], venv_backend="uv")
1419
def check_latest_schema(session):
1520
"""Make sure the CLI runs correctly"""
16-
session.install(".")
21+
session.run_install(
22+
"uv",
23+
"sync",
24+
f"--python={session.virtualenv.location}",
25+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
26+
)
1727
session.run("dbt-autofix", "print-fields-matrix")
1828

1929

20-
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"])
30+
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"], venv_backend="uv")
2131
def pytest(session):
2232
"""Run the tests"""
23-
session.install(".[test]")
24-
session.run("pytest")
33+
session.run_install(
34+
"uv",
35+
"sync",
36+
"--extra=test",
37+
f"--python={session.virtualenv.location}",
38+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
39+
)
40+
session.run("pytest", *session.posargs)
41+
42+
43+
@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13"], venv_backend="uv")
44+
def run_cli_deprecations(session):
45+
"""Make sure the deperecations CLI runs (but fails)"""
46+
session.run_install(
47+
"uv",
48+
"sync",
49+
f"--python={session.virtualenv.location}",
50+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
51+
)
52+
session.run("dbt-autofix", "deprecations")

0 commit comments

Comments
 (0)