-
Notifications
You must be signed in to change notification settings - Fork 132
ci: test upcoming Cranelift release branch #1643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 * * *" | ||
| workflow_dispatch: {} | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the default already. |
||
|
|
||
| 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. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| 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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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