Skip to content

Commit 70e41a2

Browse files
Update: Add --frozen flag to uv commands for deterministic builds
Co-Authored-By: [email protected] <[email protected]>
1 parent 398d9e6 commit 70e41a2

File tree

1 file changed

+20
-94
lines changed

1 file changed

+20
-94
lines changed

.github/workflows/python-ci.yml

Lines changed: 20 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -19,159 +19,85 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@v4
2121

22-
- name: Set up Python
23-
uses: actions/setup-python@v5
22+
- name: Install uv and set Python version
23+
uses: astral-sh/setup-uv@v4
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626

27-
- name: Install uv
28-
uses: astral-sh/setup-uv@v4
29-
30-
- name: Set up Python environment
31-
shell: bash
32-
run: |
33-
python -m venv .venv
34-
if [ "${{ runner.os }}" = "Windows" ]; then
35-
. .venv/Scripts/activate
36-
else
37-
. .venv/bin/activate
38-
fi
39-
python -m pip install --upgrade pip
40-
4127
- name: selfie-lib - install dependencies
4228
shell: bash
4329
working-directory: python/selfie-lib
4430
run: |
45-
if [ "${{ runner.os }}" = "Windows" ]; then
46-
. ../../.venv/Scripts/activate
47-
else
48-
. ../../.venv/bin/activate
49-
fi
50-
uv pip install -e .
51-
uv pip install -r requirements.txt -r dev-requirements.txt
31+
uv pip install --frozen -e .
32+
uv pip install --frozen -r requirements.txt -r dev-requirements.txt
5233
5334
- name: selfie-lib - pytest
5435
shell: bash
5536
working-directory: python/selfie-lib
5637
run: |
57-
if [ "${{ runner.os }}" = "Windows" ]; then
58-
. ../../.venv/Scripts/activate
59-
else
60-
. ../../.venv/bin/activate
61-
fi
6238
unset SELFIE || true
63-
python -m pytest -vv
39+
uv run --frozen pytest -vv
6440
6541
- name: selfie-lib - pyright
6642
shell: bash
6743
working-directory: python/selfie-lib
68-
run: |
69-
if [ "${{ runner.os }}" = "Windows" ]; then
70-
. ../../.venv/Scripts/activate
71-
else
72-
. ../../.venv/bin/activate
73-
fi
74-
python -m pyright
44+
run: uv run --frozen pyright
7545

7646
- name: selfie-lib - ruff
7747
shell: bash
7848
working-directory: python/selfie-lib
7949
run: |
80-
if [ "${{ runner.os }}" = "Windows" ]; then
81-
. ../../.venv/Scripts/activate
82-
else
83-
. ../../.venv/bin/activate
84-
fi
85-
python -m ruff format --check && python -m ruff check
50+
uv run --frozen ruff format --check
51+
uv run --frozen ruff check
8652
8753
- name: pytest-selfie - install dependencies
8854
shell: bash
8955
working-directory: python/pytest-selfie
9056
run: |
91-
if [ "${{ runner.os }}" = "Windows" ]; then
92-
. ../../.venv/Scripts/activate
93-
else
94-
. ../../.venv/bin/activate
95-
fi
96-
uv pip install -e . -e ../selfie-lib
97-
uv pip install -r requirements.txt -r dev-requirements.txt
57+
uv pip install --frozen -e . -e ../selfie-lib
58+
uv pip install --frozen -r requirements.txt -r dev-requirements.txt
9859
9960
- name: pytest-selfie - pytest
10061
shell: bash
10162
working-directory: python/pytest-selfie
10263
run: |
103-
if [ "${{ runner.os }}" = "Windows" ]; then
104-
. ../../.venv/Scripts/activate
105-
else
106-
. ../../.venv/bin/activate
107-
fi
10864
unset SELFIE || true
109-
python -m pytest -vv
65+
uv run --frozen pytest -vv
11066
11167
- name: pytest-selfie - pyright
11268
shell: bash
11369
working-directory: python/pytest-selfie
114-
run: |
115-
if [ "${{ runner.os }}" = "Windows" ]; then
116-
. ../../.venv/Scripts/activate
117-
else
118-
. ../../.venv/bin/activate
119-
fi
120-
python -m pyright
70+
run: uv run --frozen pyright
12171

12272
- name: pytest-selfie - ruff
12373
shell: bash
12474
working-directory: python/pytest-selfie
12575
run: |
126-
if [ "${{ runner.os }}" = "Windows" ]; then
127-
. ../../.venv/Scripts/activate
128-
else
129-
. ../../.venv/bin/activate
130-
fi
131-
python -m ruff format --check && python -m ruff check
76+
uv run --frozen ruff format --check
77+
uv run --frozen ruff check
13278
13379
- name: example-pytest-selfie - install dependencies
13480
shell: bash
13581
working-directory: python/example-pytest-selfie
13682
run: |
137-
if [ "${{ runner.os }}" = "Windows" ]; then
138-
. ../../.venv/Scripts/activate
139-
else
140-
. ../../.venv/bin/activate
141-
fi
142-
uv pip install -e . -e ../selfie-lib -e ../pytest-selfie
143-
uv pip install -r requirements.txt -r dev-requirements.txt
83+
uv pip install --frozen -e . -e ../selfie-lib -e ../pytest-selfie
84+
uv pip install --frozen -r requirements.txt -r dev-requirements.txt
14485
14586
- name: example-pytest-selfie - pytest
14687
shell: bash
14788
working-directory: python/example-pytest-selfie
14889
run: |
149-
if [ "${{ runner.os }}" = "Windows" ]; then
150-
. ../../.venv/Scripts/activate
151-
else
152-
. ../../.venv/bin/activate
153-
fi
15490
unset SELFIE || true
155-
python -m pytest -vv
91+
uv run --frozen pytest -vv
15692
15793
- name: example-pytest-selfie - pyright
15894
shell: bash
15995
working-directory: python/example-pytest-selfie
160-
run: |
161-
if [ "${{ runner.os }}" = "Windows" ]; then
162-
. ../../.venv/Scripts/activate
163-
else
164-
. ../../.venv/bin/activate
165-
fi
166-
python -m pyright
96+
run: uv run --frozen pyright
16797

16898
- name: example-pytest-selfie - ruff
16999
shell: bash
170100
working-directory: python/example-pytest-selfie
171101
run: |
172-
if [ "${{ runner.os }}" = "Windows" ]; then
173-
. ../../.venv/Scripts/activate
174-
else
175-
. ../../.venv/bin/activate
176-
fi
177-
python -m ruff format --check && python -m ruff check
102+
uv run --frozen ruff format --check
103+
uv run --frozen ruff check

0 commit comments

Comments
 (0)