|
| 1 | +name: Blacksmith ARM Testbox |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + testbox_id: |
| 6 | + type: string |
| 7 | + description: "Testbox session ID" |
| 8 | + required: true |
| 9 | + pull_request: |
| 10 | + paths: |
| 11 | + - ".github/workflows/**" |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +env: |
| 17 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" |
| 18 | + PNPM_CONFIG_STORE_DIR: "/tmp/openclaw-pnpm-store" |
| 19 | + PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN: "false" |
| 20 | + |
| 21 | +jobs: |
| 22 | + check-arm: |
| 23 | + if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} |
| 24 | + permissions: |
| 25 | + contents: read |
| 26 | + name: "check-arm" |
| 27 | + runs-on: blacksmith-16vcpu-ubuntu-2404-arm |
| 28 | + timeout-minutes: 120 |
| 29 | + steps: |
| 30 | + - name: Begin Testbox |
| 31 | + uses: useblacksmith/begin-testbox@d0e04585c26905fdd92c94a09c159544c7ee1b67 |
| 32 | + with: |
| 33 | + testbox_id: ${{ inputs.testbox_id }} |
| 34 | + - name: Verify ARM runner |
| 35 | + shell: bash |
| 36 | + run: | |
| 37 | + set -euo pipefail |
| 38 | +
|
| 39 | + runner_arch="$(uname -m)" |
| 40 | + echo "check-arm runner architecture: ${runner_arch}" |
| 41 | + case "$runner_arch" in |
| 42 | + aarch64 | arm64) |
| 43 | + ;; |
| 44 | + *) |
| 45 | + echo "check-arm requires an ARM64 runner; got ${runner_arch}" >&2 |
| 46 | + exit 1 |
| 47 | + ;; |
| 48 | + esac |
| 49 | + - name: Checkout |
| 50 | + shell: bash |
| 51 | + env: |
| 52 | + CHECKOUT_REPO: ${{ github.repository }} |
| 53 | + CHECKOUT_SHA: ${{ github.sha }} |
| 54 | + CHECKOUT_TOKEN: ${{ github.token }} |
| 55 | + run: | |
| 56 | + set -euo pipefail |
| 57 | +
|
| 58 | + workdir="$GITHUB_WORKSPACE" |
| 59 | + if [[ -z "$CHECKOUT_TOKEN" ]]; then |
| 60 | + echo "checkout token is missing" >&2 |
| 61 | + exit 1 |
| 62 | + fi |
| 63 | + auth_header="$(printf 'x-access-token:%s' "$CHECKOUT_TOKEN" | base64 | tr -d '\n')" |
| 64 | +
|
| 65 | + reset_checkout_dir() { |
| 66 | + mkdir -p "$workdir" |
| 67 | + find "$workdir" -mindepth 1 -maxdepth 1 -exec rm -rf {} + |
| 68 | + } |
| 69 | +
|
| 70 | + checkout_attempt() { |
| 71 | + local attempt="$1" |
| 72 | +
|
| 73 | + reset_checkout_dir |
| 74 | + git init "$workdir" >/dev/null |
| 75 | + git config --global --add safe.directory "$workdir" |
| 76 | + git -C "$workdir" remote add origin "https://github.com/${CHECKOUT_REPO}" |
| 77 | + git -C "$workdir" config gc.auto 0 |
| 78 | +
|
| 79 | + timeout --signal=TERM --kill-after=10s 30s git -C "$workdir" \ |
| 80 | + -c protocol.version=2 \ |
| 81 | + -c "http.extraheader=AUTHORIZATION: basic ${auth_header}" \ |
| 82 | + fetch --no-tags --prune --no-recurse-submodules --depth=1 origin \ |
| 83 | + "+${CHECKOUT_SHA}:refs/remotes/origin/ci-target" || return 1 |
| 84 | +
|
| 85 | + git -C "$workdir" checkout --force --detach "$CHECKOUT_SHA" || return 1 |
| 86 | + test -f "$workdir/.github/actions/setup-node-env/action.yml" || return 1 |
| 87 | + echo "checkout attempt ${attempt}/5 succeeded" |
| 88 | + } |
| 89 | +
|
| 90 | + for attempt in 1 2 3 4 5; do |
| 91 | + if checkout_attempt "$attempt"; then |
| 92 | + exit 0 |
| 93 | + fi |
| 94 | + echo "checkout attempt ${attempt}/5 failed" |
| 95 | + sleep $((attempt * 5)) |
| 96 | + done |
| 97 | +
|
| 98 | + echo "checkout failed after 5 attempts" >&2 |
| 99 | + exit 1 |
| 100 | + - name: Setup Node environment |
| 101 | + uses: ./.github/actions/setup-node-env |
| 102 | + with: |
| 103 | + install-bun: "false" |
| 104 | + - name: Prepare Testbox shell |
| 105 | + shell: bash |
| 106 | + run: | |
| 107 | + set -euo pipefail |
| 108 | +
|
| 109 | + timeout --signal=TERM --kill-after=10s 30s git \ |
| 110 | + -c protocol.version=2 \ |
| 111 | + fetch --no-tags --prune --no-recurse-submodules --depth=50 origin \ |
| 112 | + "+refs/heads/main:refs/remotes/origin/main" |
| 113 | +
|
| 114 | + node_bin="$(dirname "$(node -p 'process.execPath')")" |
| 115 | + sudo ln -sf "$node_bin/node" /usr/local/bin/node |
| 116 | + sudo ln -sf "$node_bin/npm" /usr/local/bin/npm |
| 117 | + sudo ln -sf "$node_bin/npx" /usr/local/bin/npx |
| 118 | + sudo ln -sf "$node_bin/corepack" /usr/local/bin/corepack |
| 119 | + sudo tee /usr/local/bin/pnpm >/dev/null <<'PNPM' |
| 120 | + #!/usr/bin/env bash |
| 121 | + exec /usr/local/bin/corepack pnpm "$@" |
| 122 | + PNPM |
| 123 | + sudo chmod 0755 /usr/local/bin/pnpm |
| 124 | +
|
| 125 | + - name: Hydrate Testbox provider env helper |
| 126 | + shell: bash |
| 127 | + env: |
| 128 | + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
| 129 | + ANTHROPIC_API_KEY_OLD: ${{ secrets.ANTHROPIC_API_KEY_OLD }} |
| 130 | + ANTHROPIC_API_TOKEN: ${{ secrets.ANTHROPIC_API_TOKEN }} |
| 131 | + CEREBRAS_API_KEY: ${{ secrets.CEREBRAS_API_KEY }} |
| 132 | + DEEPINFRA_API_KEY: ${{ secrets.DEEPINFRA_API_KEY }} |
| 133 | + FACTORY_API_KEY: ${{ secrets.FACTORY_API_KEY }} |
| 134 | + FIREWORKS_API_KEY: ${{ secrets.FIREWORKS_API_KEY }} |
| 135 | + GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} |
| 136 | + GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} |
| 137 | + GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} |
| 138 | + KIMI_API_KEY: ${{ secrets.KIMI_API_KEY }} |
| 139 | + MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }} |
| 140 | + MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} |
| 141 | + MOONSHOT_API_KEY: ${{ secrets.MOONSHOT_API_KEY }} |
| 142 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 143 | + OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }} |
| 144 | + OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} |
| 145 | + QWEN_API_KEY: ${{ secrets.QWEN_API_KEY }} |
| 146 | + TOGETHER_API_KEY: ${{ secrets.TOGETHER_API_KEY }} |
| 147 | + XAI_API_KEY: ${{ secrets.XAI_API_KEY }} |
| 148 | + ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }} |
| 149 | + Z_AI_API_KEY: ${{ secrets.Z_AI_API_KEY }} |
| 150 | + run: bash scripts/ci-hydrate-testbox-env.sh |
| 151 | + |
| 152 | + - name: Run Testbox |
| 153 | + uses: useblacksmith/run-testbox@5ca05834db1d3813554d1dd109e5f2087a8d7cbc |
| 154 | + if: success() |
| 155 | + env: |
| 156 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" |
0 commit comments