Skip to content
Open
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
119 changes: 119 additions & 0 deletions .github/workflows/cranelift-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Test upcoming Cranelift release branch

on:
schedule:
# Run daily so we don't miss the release branch cut.
- cron: "0 3 * * *"
Copy link
Copy Markdown
Member

@bjorn3 bjorn3 Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release branch is automatically cut on the 5th, so running once on the 6th of every month would be enough. This way there is also no need to do caching. https://github.com/bytecodealliance/wasmtime/blob/40da1d8c83e2c5e35ab5245ff4b7a5a9592422c1/.github/workflows/release-process.yml#L5-L6

View changes since the review

workflow_dispatch: {}

defaults:
run:
shell: bash
Copy link
Copy Markdown
Member

@bjorn3 bjorn3 Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default already.

View changes since the review


permissions: {}

env:
CARGO_BUILD_INCREMENTAL: false
RUSTFLAGS: "-Dwarnings"

jobs:
test_upcoming_cranelift_release:
runs-on: ubuntu-latest
timeout-minutes: 90

steps:
- uses: actions/checkout@v6

- name: Determine latest Wasmtime release branch
id: wasmtime_release_branch
run: |
set -euo pipefail
branches="$(
git ls-remote --heads https://github.com/bytecodealliance/wasmtime.git "refs/heads/release-*" \
| awk '{print $2}' \
| sed 's#refs/heads/##' \
| sort -V
)"
if [[ -z "${branches}" ]]; then
echo "No wasmtime release branches found"
exit 1
fi
latest="$(echo "${branches}" | tail -n 1)"
echo "Latest release branch: ${latest}"
echo "branch=${latest}" >> "$GITHUB_OUTPUT"

- name: Skip if already tested
id: tested_cache
uses: actions/cache@v5
with:
path: .ci/cranelift-release-tested
key: cranelift-release-tested-${{ steps.wasmtime_release_branch.outputs.branch }}

- name: Mark tested (cache payload)
if: steps.tested_cache.outputs.cache-hit != 'true'
run: |
mkdir -p .ci/cranelift-release-tested
echo "${{ steps.wasmtime_release_branch.outputs.branch }}" > .ci/cranelift-release-tested/branch.txt

- name: Patch Cargo.toml to use release branch Cranelift
if: steps.tested_cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
branch="${{ steps.wasmtime_release_branch.outputs.branch }}"

python3 - <<'PY'
import pathlib, re, os
cargo_toml = pathlib.Path("Cargo.toml")
s = cargo_toml.read_text(encoding="utf-8")

branch = os.environ["WASMTIME_RELEASE_BRANCH"]
patch_lines = "\n".join([
f'cranelift-codegen = {{ git = "https://github.com/bytecodealliance/wasmtime.git", branch = "{branch}" }}',
f'cranelift-frontend = {{ git = "https://github.com/bytecodealliance/wasmtime.git", branch = "{branch}" }}',
f'cranelift-module = {{ git = "https://github.com/bytecodealliance/wasmtime.git", branch = "{branch}" }}',
f'cranelift-native = {{ git = "https://github.com/bytecodealliance/wasmtime.git", branch = "{branch}" }}',
f'cranelift-jit = {{ git = "https://github.com/bytecodealliance/wasmtime.git", branch = "{branch}" }}',
f'cranelift-object = {{ git = "https://github.com/bytecodealliance/wasmtime.git", branch = "{branch}" }}',
])

# Ensure a [patch.crates-io] section exists.
if "[patch.crates-io]" not in s:
s += "\n\n[patch.crates-io]\n"

# Remove any previous CI-inserted patch block.
Copy link
Copy Markdown
Member

@bjorn3 bjorn3 Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't possible, right? This workflow doesn't modify the repo and each CI run has a fresh checkout of the repo. I think inserting the entire patch block at the end of Cargo.toml unconditionally would be enough.

View changes since the review

s = re.sub(
r"(?ms)^\n?# BEGIN CI WASMTIME RELEASE PATCH\n.*?^\# END CI WASMTIME RELEASE PATCH\n",
"\n",
s,
)

# Insert immediately after the [patch.crates-io] header.
s = re.sub(
r"(?m)^\[patch\.crates-io\]\s*$",
"[patch.crates-io]\n"
"# BEGIN CI WASMTIME RELEASE PATCH\n"
f"{patch_lines}\n"
"# END CI WASMTIME RELEASE PATCH",
s,
count=1,
)

cargo_toml.write_text(s, encoding="utf-8")
PY
env:
WASMTIME_RELEASE_BRANCH: ${{ steps.wasmtime_release_branch.outputs.branch }}

- name: Prepare dependencies
if: steps.tested_cache.outputs.cache-hit != 'true'
run: ./y.sh prepare

- name: Build (sysroot none)
if: steps.tested_cache.outputs.cache-hit != 'true'
run: ./y.sh build --sysroot none

- name: Test
if: steps.tested_cache.outputs.cache-hit != 'true'
env:
TARGET_TRIPLE: x86_64-unknown-linux-gnu
run: ./y.sh test

Loading