Skip to content

Commit ab8a9d5

Browse files
authored
Merge pull request #22 from cloudflare/dominik/vendoring-ci
Implements vendoring CI.
2 parents 4cecd49 + 0fcabd5 commit ab8a9d5

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

.github/workflows/vendoring.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Python Workers Vendoring CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
vendoring:
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
runs-on: ${{ matrix.os }}
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: '3.12'
26+
27+
- name: Install Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 22
31+
32+
- name: Install Wrangler
33+
run: npm install -g wrangler
34+
35+
- name: Run vendoring script (Linux/macOS)
36+
if: runner.os != 'Windows'
37+
run: ./.github/workflows/vendoring/unix.sh
38+
shell: bash
39+
40+
- name: Run vendoring script (Windows)
41+
if: runner.os == 'Windows'
42+
continue-on-error: true
43+
run: .github\workflows\vendoring\windows.bat
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
cd 06-vendoring
4+
python3.12 -m venv .venv
5+
source .venv/bin/activate
6+
.venv/bin/pip install pyodide-build
7+
.venv/bin/pyodide venv .venv-pyodide
8+
.venv-pyodide/bin/pip install -t src/vendor -r vendor.txt
9+
10+
if [ -z "$(ls -A src/vendor)" ]; then
11+
echo "Vendoring failed: No files in src/vendor"
12+
exit 1
13+
fi
14+
15+
wrangler deploy --dry-run
16+
17+
echo "Vendoring succeeded, listing files in src/vendor..."
18+
command -v tree &>/dev/null && tree src/vendor || find src/vendor
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@echo off
2+
3+
cd 06-vendoring
4+
python -m venv .venv
5+
call .venv\Scripts\activate
6+
.venv\Scripts\pip install pyodide-build
7+
.venv\Scripts\pyodide venv .venv-pyodide
8+
.venv-pyodide\Scripts\pip install -t src/vendor -r vendor.txt
9+
10+
if not exist src\vendor\* (
11+
echo Vendoring failed: No files in src/vendor
12+
exit /b 1
13+
)
14+
15+
wrangler deploy --dry-run
16+
17+
echo Vendoring succeeded, listing files in src/vendor...
18+
tree /f /a src\vendor

06-vendoring/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Vendored packages are added to your source files and need to be installed in a s
1212

1313
### Vendoring Packages
1414

15+
[//]: # (NOTE: when updating the instructions below, be sure to also update the vendoring.yml CI workflow)
16+
1517
First, install Python3.12 and pip for Python 3.12.
1618

1719
*Currently, other versions of Python will not work - use 3.12!*

0 commit comments

Comments
 (0)