Skip to content

Commit a030324

Browse files
fix: add virtual environment setup for uv in CI workflows
Co-Authored-By: Aaron <AJ> Steers <aj@airbyte.io>
1 parent fd90bc4 commit a030324

File tree

2 files changed

+64
-30
lines changed

2 files changed

+64
-30
lines changed

.github/workflows/python_lint.yml

+24-9
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ jobs:
2424
cache: 'pip'
2525
- name: Install uv
2626
run: curl -LsSf https://astral.sh/uv/install.sh | sh
27-
- name: Install dependencies
28-
run: uv pip install -e ".[dev]"
27+
- name: Setup environment and install dependencies
28+
run: |
29+
uv venv
30+
source .venv/bin/activate
31+
uv pip install -e ".[dev]"
2932
3033
# Job-specifc step(s):
3134
- name: Format code
32-
run: uv run ruff check .
35+
run: |
36+
source .venv/bin/activate
37+
uv run ruff check .
3338
3439
ruff-format-check:
3540
name: Ruff Format Check
@@ -45,12 +50,17 @@ jobs:
4550
cache: 'pip'
4651
- name: Install uv
4752
run: curl -LsSf https://astral.sh/uv/install.sh | sh
48-
- name: Install dependencies
49-
run: uv pip install -e ".[dev]"
53+
- name: Setup environment and install dependencies
54+
run: |
55+
uv venv
56+
source .venv/bin/activate
57+
uv pip install -e ".[dev]"
5058
5159
# Job-specifc step(s):
5260
- name: Check code format
53-
run: uv run ruff format --check .
61+
run: |
62+
source .venv/bin/activate
63+
uv run ruff format --check .
5464
5565
mypy-check:
5666
name: MyPy Check
@@ -66,9 +76,14 @@ jobs:
6676
cache: 'pip'
6777
- name: Install uv
6878
run: curl -LsSf https://astral.sh/uv/install.sh | sh
69-
- name: Install dependencies
70-
run: uv pip install -e ".[dev]"
79+
- name: Setup environment and install dependencies
80+
run: |
81+
uv venv
82+
source .venv/bin/activate
83+
uv pip install -e ".[dev]"
7184
7285
# Job-specifc step(s):
7386
- name: Check MyPy typing
74-
run: uv run mypy .
87+
run: |
88+
source .venv/bin/activate
89+
uv run mypy .

.github/workflows/python_pytest.yml

+40-21
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,21 @@ jobs:
3434
cache: 'pip'
3535
- name: Install uv
3636
run: curl -LsSf https://astral.sh/uv/install.sh | sh
37-
- name: Install dependencies
38-
run: uv pip install -e ".[dev]"
37+
- name: Setup environment and install dependencies
38+
run: |
39+
uv venv
40+
source .venv/bin/activate
41+
uv pip install -e ".[dev]"
3942
4043
- name: Run Pytest with Coverage (Fast Tests Only)
4144
timeout-minutes: 60
4245
env:
4346
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
44-
run: >
45-
uv run coverage run -m pytest
46-
--durations=5 --exitfirst
47-
-m "not slow and not requires_creds and not linting and not flaky"
47+
run: |
48+
source .venv/bin/activate
49+
uv run coverage run -m pytest \
50+
--durations=5 --exitfirst \
51+
-m "not slow and not requires_creds and not linting and not flaky"
4852
4953
- name: Run Pytest with Coverage (Flaky Tests Only)
5054
timeout-minutes: 60
@@ -58,11 +62,14 @@ jobs:
5862
5963
- name: Print Coverage Report
6064
if: always()
61-
run: uv run coverage report
65+
run: |
66+
source .venv/bin/activate
67+
uv run coverage report
6268
6369
- name: Create Coverage Artifacts
6470
if: always()
6571
run: |
72+
source .venv/bin/activate
6673
uv run coverage html -d htmlcov
6774
uv run coverage xml -o htmlcov/coverage.xml
6875
@@ -87,19 +94,23 @@ jobs:
8794
cache: 'pip'
8895
- name: Install uv
8996
run: curl -LsSf https://astral.sh/uv/install.sh | sh
90-
- name: Install dependencies
91-
run: uv pip install -e ".[dev]"
97+
- name: Setup environment and install dependencies
98+
run: |
99+
uv venv
100+
source .venv/bin/activate
101+
uv pip install -e ".[dev]"
92102
93103
# Job-specific step(s):
94104
- name: Run Pytest (No-Creds)
95105
timeout-minutes: 60
96106
env:
97107
# Force this to a blank value.
98108
GCP_GSM_CREDENTIALS: ""
99-
run: >
100-
uv run coverage run -m pytest
101-
--durations=5 --exitfirst
102-
-m "not requires_creds and not linting and not super_slow and not flaky"
109+
run: |
110+
source .venv/bin/activate
111+
uv run coverage run -m pytest \
112+
--durations=5 --exitfirst \
113+
-m "not requires_creds and not linting and not super_slow and not flaky"
103114
104115
- name: Print Coverage Report
105116
if: always()
@@ -152,18 +163,22 @@ jobs:
152163
cache: 'pip'
153164
- name: Install uv
154165
run: curl -LsSf https://astral.sh/uv/install.sh | sh
155-
- name: Install dependencies
156-
run: uv pip install -e ".[dev]"
166+
- name: Setup environment and install dependencies
167+
run: |
168+
uv venv
169+
source .venv/bin/activate
170+
uv pip install -e ".[dev]"
157171
158172
# Job-specific step(s):
159173
- name: Run Pytest
160174
timeout-minutes: 60
161175
env:
162176
GCP_GSM_CREDENTIALS: ${{ secrets.GCP_GSM_CREDENTIALS }}
163-
run: >
164-
uv run coverage run -m pytest
165-
--verbose
166-
-m "not linting and not super_slow and not flaky"
177+
run: |
178+
source .venv/bin/activate
179+
uv run coverage run -m pytest \
180+
--verbose \
181+
-m "not linting and not super_slow and not flaky"
167182
168183
- name: Print Coverage Report
169184
if: always()
@@ -195,10 +210,14 @@ jobs:
195210
cache: 'pip'
196211
- name: Install uv
197212
run: curl -LsSf https://astral.sh/uv/install.sh | sh
198-
- name: Install dependencies
199-
run: uv pip install -e ".[dev]"
213+
- name: Setup environment and install dependencies
214+
run: |
215+
uv venv
216+
source .venv/bin/activate
217+
uv pip install -e ".[dev]"
200218
201219
# Job-specific step(s):
202220
- name: Run Deptry
203221
run: |
222+
source .venv/bin/activate
204223
uv run deptry .

0 commit comments

Comments
 (0)