Skill Tracer
Skills › gstack › gstack › setup-free-suite.sh

setup-free-suite.sh

63 lines · scripts/ubicloud/setup-free-suite.sh at 3f79d81

1#!/usr/bin/env bash
2# Bootstrap a fresh ubuntu-noble Ubicloud VM to run the free suite exactly as
3# the required CI lane does (.github/workflows/free-tests.yml, free-suite job).
4# Runs as user `ubi` (passwordless sudo) from the synced checkout.
5set -euo pipefail
6
7BUN_VERSION=1.4.2
8NODE_VERSION=22.23.4
9NODE_SHA256=1805bcd35e6815559bd2eb97db438d3fdb0eb3a5e6a977b7c1badca76337e9ce
11export DEBIAN_FRONTEND=noninteractive
12sudo -E apt-get update -qq
13sudo -E apt-get install -y -qq --no-install-recommends \
14 git curl unzip zip xz-utils ca-certificates build-essential python3-venv jq \
15 xvfb x11-utils poppler-utils fonts-noto-color-emoji zsh >/dev/null
17# Ubuntu 24.04 blocks unprivileged user namespaces, which Chromium's sandbox
18# needs; GitHub-hosted runners ship with this relaxed.
19sudo sysctl -qw kernel.apparmor_restrict_unprivileged_userns=0
21# The same verified release archive as .github/docker/Dockerfile.ci.
22if ! command -v node >/dev/null; then
23 node_tmp=$(mktemp -d)
24 curl -fsSL "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.xz" -o "$node_tmp/node.tar.xz"
25 echo "$NODE_SHA256 $node_tmp/node.tar.xz" | sha256sum -c - >/dev/null
26 sudo tar -xJ -C /usr/local --strip-components=1 -f "$node_tmp/node.tar.xz"
27 rm -rf "$node_tmp"
28fi
30# The exact release archive, verified by SHA-256 before it is unpacked, as in
31# .github/docker/Dockerfile.ci (test/ci-image-cli-pin.test.ts keeps them equal).
32if [ ! -x "$HOME/.bun/bin/bun" ]; then
33 bun_tmp=$(mktemp -d)
34 curl --retry 5 --retry-delay 5 --retry-connrefused -fsSL \
35 "https://github.com/oven-sh/bun/releases/download/bun-v$BUN_VERSION/bun-linux-x64.zip" -o "$bun_tmp/bun.zip"
36 echo "36368faef7527875d5ffa52e53cd48021741f2a83eb6208a8dd64068d422a913 $bun_tmp/bun.zip" | sha256sum -c - >/dev/null
37 unzip -q "$bun_tmp/bun.zip" -d "$bun_tmp"
38 install -D -m 0755 "$bun_tmp/bun-linux-x64/bun" "$HOME/.bun/bin/bun"
39 ln -sf bun "$HOME/.bun/bin/bunx"
40 rm -rf "$bun_tmp"
41fi
42grep -q '.bun/bin' "$HOME/.profile" || echo 'export PATH="$HOME/.bun/bin:$PATH"' >>"$HOME/.profile"
43export PATH="$HOME/.bun/bin:$PATH"
44test "$(bun --version)" = "$BUN_VERSION"
46git config --global user.email "free-tests@gstack.test"
47git config --global user.name "Free Tests"
48git config --global init.defaultBranch main
49git config --global --add safe.directory '*'
51bun install --frozen-lockfile
52bunx playwright install --with-deps chromium
54chrome=$(bun --no-env-file --config=/dev/null -e 'import { chromium } from "playwright"; import { realpathSync } from "node:fs"; console.log(realpathSync(chromium.executablePath()))')
55sudo install -T -o root -g root -m 4755 "${chrome%/*}/chrome_sandbox" "${chrome%/*}/chrome-sandbox"
58 bun run gen:skill-docs --host all
59 bun run vendor:xterm
60 bash browse/scripts/build-node-server.sh
61 bun run build:gates
62 bun run build:cso
63} >/dev/null