Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/vendoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Python Workers Vendoring CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
vendoring:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install Wrangler
run: npm install -g wrangler

- name: Run vendoring script (Linux/macOS)
if: runner.os != 'Windows'
run: ./.github/workflows/vendoring/unix.sh
shell: bash

- name: Run vendoring script (Windows)
if: runner.os == 'Windows'
continue-on-error: true
run: .github\workflows\vendoring\windows.bat
18 changes: 18 additions & 0 deletions .github/workflows/vendoring/unix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

cd 06-vendoring
python3.12 -m venv .venv
source .venv/bin/activate
.venv/bin/pip install pyodide-build
.venv/bin/pyodide venv .venv-pyodide
.venv-pyodide/bin/pip install -t src/vendor -r vendor.txt

if [ -z "$(ls -A src/vendor)" ]; then
echo "Vendoring failed: No files in src/vendor"
exit 1
fi

wrangler deploy --dry-run

echo "Vendoring succeeded, listing files in src/vendor..."
command -v tree &>/dev/null && tree src/vendor || find src/vendor
18 changes: 18 additions & 0 deletions .github/workflows/vendoring/windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off

cd 06-vendoring
python -m venv .venv
call .venv\Scripts\activate
.venv\Scripts\pip install pyodide-build
.venv\Scripts\pyodide venv .venv-pyodide
.venv-pyodide\Scripts\pip install -t src/vendor -r vendor.txt

if not exist src\vendor\* (
echo Vendoring failed: No files in src/vendor
exit /b 1
)

wrangler deploy --dry-run

echo Vendoring succeeded, listing files in src/vendor...
tree /f /a src\vendor
2 changes: 2 additions & 0 deletions 06-vendoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Vendored packages are added to your source files and need to be installed in a s

### Vendoring Packages

[//]: # (NOTE: when updating the instructions below, be sure to also update the vendoring.yml CI workflow)

First, install Python3.12 and pip for Python 3.12.

*Currently, other versions of Python will not work - use 3.12!*
Expand Down
Loading