Skip to content

Commit 11fe38f

Browse files
authored
Further harden CI/CD (#15)
* CI cleanup * Add pyproject.toml * Add lockfile and requirements files * Use pinned Python requirements in CI/CD
1 parent 50a244c commit 11fe38f

8 files changed

Lines changed: 254 additions & 8 deletions

File tree

.github/actionlint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
paths:
2+
.github/workflows/build.yml:
3+
ignore:
4+
# SC1090 "Can't follow non-constant source": ignore when using `source` to activate venv
5+
- '.+SC1090.+'

.github/workflows/build.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,26 @@ jobs:
7777
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
7878
f.write(f'matrix={json.dumps(matrix)}')
7979
80-
- name: Checkout
80+
- name: Checkout Pyinstaller-Builds
81+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
82+
with:
83+
path: builds
84+
persist-credentials: false
85+
86+
- name: Checkout PyInstaller
8187
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8288
with:
8389
fetch-depth: 0 # Needed for git-describe
8490
repository: pyinstaller/pyinstaller
8591
ref: ${{ inputs.commitish }}
92+
path: pyinstaller
8693
persist-credentials: false
8794

8895
- name: Git describe
8996
id: git_describe
9097
shell: bash
9198
run: |
99+
cd pyinstaller
92100
git describe --tags # So the script will exit on error
93101
echo "tag=$(git describe --tags)" >> "${GITHUB_OUTPUT}"
94102
@@ -132,17 +140,26 @@ jobs:
132140
with:
133141
python-version: "3.14"
134142

143+
- name: Install Python dependencies
144+
run: |
145+
cd pyinstaller
146+
python -m venv --clear venv
147+
source venv/bin/activate
148+
python -m pip install -U --require-hashes -r "../builds/requirements/pip.txt"
149+
python -m pip install -U --require-hashes -r "../builds/requirements/build.txt"
150+
135151
- name: Build source distribution
136152
run: |
137-
python -m pip install -U build hatchling
153+
cd pyinstaller
154+
source venv/bin/activate
138155
python -m build --no-isolation --sdist --outdir=dist .
139156
140157
- name: Upload artifacts
141158
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
142159
with:
143160
name: pyinstaller-${{ inputs.commitish }}-sdist
144161
path: |
145-
dist/*
162+
pyinstaller/dist/*
146163
compression-level: 0
147164

148165
build:
@@ -171,35 +188,51 @@ jobs:
171188
mingw-w64-${{ matrix.env }}-python
172189
mingw-w64-${{ matrix.env }}-python-pip
173190
174-
- name: Checkout
191+
- name: Checkout Pyinstaller-Builds
192+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
193+
with:
194+
path: builds
195+
persist-credentials: false
196+
197+
- name: Checkout PyInstaller
175198
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
176199
with:
177200
repository: pyinstaller/pyinstaller
178201
ref: ${{ inputs.commitish }}
202+
path: pyinstaller
179203
persist-credentials: false
180204

181205
- name: Build bootloader
182206
env:
183207
ARCH: ${{ matrix.arch }}
184208
COMPILER: ${{ matrix.compiler }}
185209
run: |
186-
cd bootloader
210+
cd pyinstaller/bootloader
187211
python ./waf --target-arch="${ARCH}" --"${COMPILER}" distclean all
188212
213+
- name: Install Python dependencies
214+
run: |
215+
cd pyinstaller
216+
python -m venv --clear venv
217+
source venv/bin/activate
218+
python -m pip install -U --require-hashes -r "../builds/requirements/pip.txt"
219+
python -m pip install -U --require-hashes -r "../builds/requirements/build.txt"
220+
189221
- name: Build wheel
190222
env:
191223
PYI_WHEEL_TAG: ${{ matrix.wheel_tag }}
192224
PYI_PLATFORM: ${{ matrix.platform }}
193225
run: |
194-
python -m pip install -U build hatchling
226+
cd pyinstaller
227+
source venv/bin/activate
195228
python -m build --no-isolation --wheel --outdir=dist .
196229
197230
- name: Upload artifacts
198231
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
199232
with:
200233
name: pyinstaller-${{ inputs.commitish }}-${{ matrix.name }}
201234
path: |
202-
dist/*
235+
pyinstaller/dist/*
203236
compression-level: 0
204237

205238
release:

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: CI
22
on:
33
push:
44
branches: ['master']
5+
# This workflow contains required checks and needs to run for EVERY pull_request
56
pull_request:
67
branches: ['**']
78

@@ -19,6 +20,7 @@ env:
1920

2021
jobs:
2122
actionlint:
23+
# Required check; do not change name
2224
name: actionlint
2325
permissions:
2426
contents: read
@@ -32,14 +34,18 @@ jobs:
3234
with:
3335
python-version: "3.14"
3436

37+
- name: Install Python dependencies
38+
run: |
39+
python -m pip install -U --require-hashes -r "requirements/pip.txt"
40+
python -m pip install -U --require-hashes -r "requirements/pyflakes.txt"
41+
3542
- name: Install requirements
3643
env:
3744
GH_TOKEN: ${{ github.token }}
3845
ACTIONLINT_TARBALL: ${{ format('actionlint_{0}_linux_amd64.tar.gz', env.ACTIONLINT_VERSION) }}
3946
shell: bash
4047
run: |
4148
sudo apt -y install shellcheck
42-
python -m pip install -U pyflakes
4349
gh release download \
4450
--repo "${ACTIONLINT_REPO}" \
4551
--pattern "${ACTIONLINT_TARBALL}" \
@@ -50,11 +56,13 @@ jobs:
5056
printf '%s %s' "${ACTIONLINT_SHA256SUM}" "${ACTIONLINT_TARBALL}" | sha256sum -c -
5157
tar xvzf "${ACTIONLINT_TARBALL}" actionlint
5258
sudo install -D --mode=755 actionlint /usr/bin/
59+
5360
- name: Run actionlint
5461
run: |
5562
actionlint -color
5663
5764
zizmor:
65+
# Required check; do not change name
5866
name: zizmor
5967
permissions:
6068
contents: read
@@ -64,6 +72,7 @@ jobs:
6472
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6573
with:
6674
persist-credentials: false
75+
6776
- name: Run zizmor
6877
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
6978
with:

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[project]
2+
name = "Pyinstaller-Builds"
3+
version = "0.1.0"
4+
maintainers = [
5+
{email = "maintainers@yt-dlp.org"},
6+
]
7+
description = "PyInstaller builds for yt-dlp"
8+
readme = "README.md"
9+
requires-python = ">=3.13"
10+
license = "Unlicense"
11+
license-files = ["LICENSE"]
12+
13+
[dependency-groups]
14+
build = [
15+
"build",
16+
"hatchling>=1.27.0",
17+
]
18+
pip = [
19+
"pip",
20+
]
21+
pyflakes = [
22+
"pyflakes~=3.4.0",
23+
]
24+
25+
[tool.uv]
26+
exclude-newer = "7 days"

requirements/build.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
build==1.4.4 \
2+
--hash=sha256:8c3f48a6090b39edec1a273d2d57949aaf13723b01e02f9d518396887519f64d \
3+
--hash=sha256:f832ae053061f3fb524af812dc94b8b84bac6880cd587630e3b5d91a6a9c1703
4+
colorama==0.4.6 ; os_name == 'nt' \
5+
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \
6+
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6
7+
# via build
8+
hatchling==1.29.0 \
9+
--hash=sha256:50af9343281f34785fab12da82e445ed987a6efb34fd8c2fc0f6e6630dbcc1b0 \
10+
--hash=sha256:793c31816d952cee405b83488ce001c719f325d9cda69f1fc4cd750527640ea6
11+
packaging==26.2 \
12+
--hash=sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e \
13+
--hash=sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661
14+
# via
15+
# build
16+
# hatchling
17+
pathspec==1.1.1 \
18+
--hash=sha256:17db5ecd524104a120e173814c90367a96a98d07c45b2e10c2f3919fff91bf5a \
19+
--hash=sha256:a00ce642f577bf7f473932318056212bc4f8bfdf53128c78bbd5af0b9b20b189
20+
# via hatchling
21+
pluggy==1.6.0 \
22+
--hash=sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3 \
23+
--hash=sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746
24+
# via hatchling
25+
pyproject-hooks==1.2.0 \
26+
--hash=sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8 \
27+
--hash=sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913
28+
# via build
29+
trove-classifiers==2026.1.14.14 \
30+
--hash=sha256:00492545a1402b09d4858605ba190ea33243d361e2b01c9c296ce06b5c3325f3 \
31+
--hash=sha256:1f9553927f18d0513d8e5ff80ab8980b8202ce37ecae0e3274ed2ef11880e74d
32+
# via hatchling

requirements/pip.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pip==26.1 \
2+
--hash=sha256:4e8486d821d814b77319acb7b9e8bf5a4ee7590a643e7cb21029f209be8573c1 \
3+
--hash=sha256:81e13ebcca3ffa8cc85e4deff5c27e1ee26dea0aa7fc2f294a073ac208806ff3

requirements/pyflakes.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pyflakes==3.4.0 \
2+
--hash=sha256:b24f96fafb7d2ab0ec5075b7350b3d2d2218eab42003821c06344973d3ea2f58 \
3+
--hash=sha256:f742a7dbd0d9cb9ea41e9a24a918996e8170c799fa528688d40dd582c8265f4f

uv.lock

Lines changed: 135 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)