mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-10-21 03:06:17 +00:00
## Description We started seeing rate-limit `429` errors when cloning LLVM (as seen in e.g. [this failed run](https://github.com/paritytech/revive/actions/runs/28924583524/job/85809154518) and [this failed run](https://github.com/paritytech/revive/actions/runs/28926259175/job/85821336465?pr=564)). `llvm/llvm-project` now seems to be heavily rate-limited by GitHub. (Authenticating the clone did not seem to have much effect.) Even though our resolc build steps only do a treeless clone, all build steps still did the same clone. ### Changes * I've instead introduced a `.llvm-version` file that the `get-llvm` action reads from, eliminating the network request all together. * `.llvm-version` is meant to be kept in sync with the LLVM submodule version we use. This is enforced by: * Introduced a `check-llvm-version.yml` workflow * Runs once to check that the recorded version in `.llvm-version` coincides with the version detected from the submodule. * The submodule version detection *does* perform a network request as before, but this is only run once now (when relevant files change), rather than for all our resolc build jobs. * Since the differential test jobs require checking out our revive-differential-tests (rdt) submodule, those checkout steps cloned not only rdt, but also LLVM. I've updated this to not clone LLVM at all.
58 lines
2.0 KiB
YAML
58 lines
2.0 KiB
YAML
# Guards the checked-in .llvm-version file, which CI reads (via the get-llvm
|
|
# action) to select the prebuilt LLVM release to build against. Whenever the
|
|
# llvm submodule pin or the file changes, this derives the version from the
|
|
# pinned commit and fails if the file was not updated to match.
|
|
|
|
name: Check LLVM Version
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- "llvm"
|
|
- ".llvm-version"
|
|
- ".gitmodules"
|
|
- ".github/workflows/check-llvm-version.yml"
|
|
- ".github/actions/get-llvm/action.yml"
|
|
pull_request:
|
|
types: [opened, synchronize]
|
|
paths:
|
|
- "llvm"
|
|
- ".llvm-version"
|
|
- ".gitmodules"
|
|
- ".github/workflows/check-llvm-version.yml"
|
|
- ".github/actions/get-llvm/action.yml"
|
|
|
|
jobs:
|
|
check-llvm-version:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout revive
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Verify .llvm-version Matches the Submodule Pin
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
LLVM_SHA=$(git ls-tree HEAD llvm | awk '{print $3}')
|
|
LLVM_URL=$(git config -f .gitmodules submodule.llvm.url)
|
|
|
|
# Do a treeless clone to avoid unnecessarily fetching source files.
|
|
git clone --filter=tree:0 --no-checkout \
|
|
"https://x-access-token:${GH_TOKEN}@${LLVM_URL#https://}" llvm-tmp
|
|
|
|
# Try to get the most recent tag (e.g., "llvmorg-18.1.8").
|
|
DETECTED_LLVM_TAG=$(git -C llvm-tmp describe --tags --abbrev=0 "$LLVM_SHA")
|
|
|
|
# Convert "llvmorg-x.y.z" to "llvm-x.y.z".
|
|
DETECTED_LLVM_VERSION=$(echo "$DETECTED_LLVM_TAG" | sed 's/^llvmorg-/llvm-/')
|
|
RECORDED_LLVM_VERSION=$(cat .llvm-version)
|
|
|
|
if [ "$DETECTED_LLVM_VERSION" != "$RECORDED_LLVM_VERSION" ]; then
|
|
echo "::error file=.llvm-version::.llvm-version contains '$RECORDED_LLVM_VERSION' but the submodule pin describes to '$DETECTED_LLVM_VERSION'."
|
|
exit 1
|
|
fi
|
|
echo "OK: .llvm-version ($RECORDED_LLVM_VERSION) matches the submodule pin."
|