ci(upstream-merge): use cached static binaries for ripgrep/jq; add PATH; add debug trace for context prep

This commit is contained in:
James Peter
2025-09-07 20:36:07 +10:00
parent 8ee54b8513
commit 23f1084e1a
+46 -12
View File
@@ -29,6 +29,8 @@ env:
UPSTREAM_REPO: ${{ inputs.upstream_repo || 'openai/codex' }}
UPSTREAM_BRANCH: ${{ inputs.upstream_branch || 'main' }}
MERGE_BRANCH: upstream-merge
RG_VERSION: '14.1.0'
JQ_VERSION: '1.7.1'
jobs:
merge:
@@ -61,21 +63,52 @@ jobs:
with:
toolchain: 1.89.0
- name: Ensure tools present (ripgrep + jq)
- name: Add local bin to PATH
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Cache ripgrep binary
uses: actions/cache@v4
with:
path: ~/.local/tools/rg-${{ env.RG_VERSION }}
key: rg-${{ runner.os }}-${{ env.RG_VERSION }}
- name: Setup ripgrep (cached)
run: |
set -euo pipefail
need_rg=0; need_jq=0
command -v rg >/dev/null 2>&1 || need_rg=1
command -v jq >/dev/null 2>&1 || need_jq=1
if [ $need_rg -eq 0 ] && [ $need_jq -eq 0 ]; then
echo "ripgrep and jq already available; skipping apt."
exit 0
if command -v rg >/dev/null 2>&1; then rg --version; exit 0; fi
mkdir -p "$HOME/.local/tools" "$HOME/.local/bin"
if [ ! -x "$HOME/.local/tools/rg-${RG_VERSION}/rg" ]; then
cd "$HOME/.local/tools"
TARBALL="ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl.tar.gz"
URL="https://github.com/BurntSushi/ripgrep/releases/download/${RG_VERSION}/${TARBALL}"
curl -sSL "$URL" -o "$TARBALL"
tar -xzf "$TARBALL"
rm -f "$TARBALL"
mv "ripgrep-${RG_VERSION}-x86_64-unknown-linux-musl" "rg-${RG_VERSION}"
fi
sudo apt-get update
pkgs=()
[ $need_rg -eq 1 ] && pkgs+=(ripgrep)
[ $need_jq -eq 1 ] && pkgs+=(jq)
sudo apt-get install -y "${pkgs[@]}"
install -m 0755 "$HOME/.local/tools/rg-${RG_VERSION}/rg" "$HOME/.local/bin/rg"
rg --version
- name: Cache jq binary
uses: actions/cache@v4
with:
path: ~/.local/tools/jq-${{ env.JQ_VERSION }}
key: jq-${{ runner.os }}-${{ env.JQ_VERSION }}
- name: Setup jq (cached)
run: |
set -euo pipefail
if command -v jq >/dev/null 2>&1; then jq --version; exit 0; fi
mkdir -p "$HOME/.local/tools/jq-${JQ_VERSION}" "$HOME/.local/bin"
URL="https://github.com/jqlang/jq/releases/download/jq-${JQ_VERSION}/jq-linux-amd64"
curl -sSL "$URL" -o "$HOME/.local/tools/jq-${JQ_VERSION}/jq"
chmod +x "$HOME/.local/tools/jq-${JQ_VERSION}/jq"
install -m 0755 "$HOME/.local/tools/jq-${JQ_VERSION}/jq" "$HOME/.local/bin/jq"
jq --version
# Remove slow apt install; we now use cached static binaries for rg/jq
- name: Cache Rust build (cargo + target)
uses: Swatinem/rust-cache@v2
@@ -192,6 +225,7 @@ jobs:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch || 'main' }}
run: |
set -euo pipefail
set -x
mkdir -p .github/auto
git remote add upstream "https://github.com/${UPSTREAM_REPO}.git" 2>/dev/null || true
# Fetch with commit graph but no blobs for speed; ensure sufficient history for merge-base