Repository navigation
108 lines (92 loc) · 3.88 KB
/
Copy pathrelease-python-snapshots.yml
File metadata and controls
108 lines (92 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Make Python Snapshots
on:
workflow_dispatch:
inputs:
update-released-baseline-snapshots:
description: 'Update already released baseline snapshots?'
required: false
default: false
type: boolean
jobs:
build-linux:
uses: ./.github/workflows/_bazel.yml
with:
image: ubuntu-22.04
os_name: linux
arch_name: 'X64'
suffix: ''
run_tests: false
extra_bazel_args: '--config=ci-linux --config=ci-test'
upload_binary: true
secrets:
BAZEL_CACHE_KEY: ${{ secrets.BAZEL_CACHE_KEY }}
WORKERS_MIRROR_URL: ${{ secrets.WORKERS_MIRROR_URL }}
GOOGLESOURCE_COOKIE: ${{ secrets.GOOGLESOURCE_COOKIE }}
build:
needs: [build-linux]
runs-on: ubuntu-22.04
name: Build and upload Python memory snapshots
steps:
- uses: actions/checkout@v7
with:
show-progress: false
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Setup Runner
uses: ./.github/actions/setup-runner
with:
GOOGLESOURCE_COOKIE: ${{ secrets.GOOGLESOURCE_COOKIE }}
- name: Download workerd binary
uses: actions/download-artifact@v8
with:
name: linux-X64-binary
path: /tmp
- name: Make workerd binary executable
run: chmod +x /tmp/workerd
- name: Build and upload Python memory snapshots
env:
R2_ACCOUNT_ID: ${{ secrets.PYODIDE_CAPNP_R2_ACCOUNT_ID }}
R2_ACCESS_KEY_ID: ${{ secrets.PYODIDE_CAPNP_R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.PYODIDE_CAPNP_R2_SECRET_ACCESS_KEY }}
WORKERD_BINARY: "/tmp/workerd"
run: |
bazel build @workerd//src/pyodide:bundle_version_info
# boto3 v1.36.0 fails with:
# NotImplemented error occurred in CreateMultipartUpload operation: Header 'x-amz-checksum-algorithm' with value 'CRC32' not implemented
pip install 'boto3<1.36.0' requests
python3 src/pyodide/make_snapshots.py ${{ inputs.update-released-baseline-snapshots == true && '--update-released-baseline-snapshots' || '' }}
- name: Check for open PR and commit changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Commit changes to python_metadata.bzl and push to branch
# Configure git
git config --local user.email "action@github.com"
git config --local user.name "release-python-snapshots.yml GitHub Action"
# Get current branch name
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
echo "Current branch: $BRANCH_NAME"
# Check if there are changes to python_metadata.bzl
if git diff --quiet build/python_metadata.bzl; then
echo "No changes to python_metadata.bzl"
exit 0
fi
echo "Changes detected in python_metadata.bzl"
# Check if there's an open PR for this branch
PR_COUNT=$(gh pr list --head "$BRANCH_NAME" --state open --json number --jq length)
if [ "$PR_COUNT" -eq 0 ]; then
echo "No open PR found for branch $BRANCH_NAME, skipping commit"
exit 0
fi
echo "Found open PR for branch $BRANCH_NAME"
# Commit and push the changes
git add build/python_metadata.bzl
git commit --fixup HEAD -m "Update python_metadata.bzl with new snapshot info
This commit updates the snapshot values in python_metadata.bzl based on the latest
snapshot uploads.
🤖 Generated automatically by release-python-snapshots workflow"
# --no-verify because 'git merge-base origin/main HEAD' fails in pre-commit.
# There shouldn't be formatting errors anyways and if there are CI will catch it.
git push origin "$BRANCH_NAME" --no-verify
echo "Changes committed and pushed to $BRANCH_NAME"