Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 126 additions & 3 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,129 @@
---
name: Nitro CI Setup
description: Common setup for Nitro CI jobs
description: Common setup for Nitro CI jobs with per-step timing

runs:
using: composite

steps:
- name: Install dependencies
run: sudo apt update && sudo apt install -y wabt gotestsum
# -------------------- TIMING: INIT --------------------
- name: ⏱️ Init timing
shell: bash
run: |
TIMER_FILE="$RUNNER_TEMP/step-marks.tsv"
echo -e "ts_ms\tlabel" > "$TIMER_FILE"
echo -e "$(date +%s%3N)\tBEGIN" >> "$TIMER_FILE"
echo "TIMER_FILE=$TIMER_FILE" >> "$GITHUB_ENV"

- name: Update dependencies
run: sudo apt-get update
shell: bash
- name: ⏱️ mark — Update dependencies
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tUpdate dependencies" >> "$TIMER_FILE"

- name: Cache host tools (wabt, gotestsum, lld)
id: cache-host-tools
uses: actions/cache@v4
with:
path: |
~/.local/bin/wat2wasm
~/.local/bin/wasm2wat
~/.local/bin/wabt-strip
~/.local/bin/gotestsum
key: ${{ runner.os }}-hosttools-wabt-1.0.36-gotestsum-1.11.0

- name: Install host tools (wabt, gotestsum, lld) — user-space
if: steps.cache-host-tools.outputs.cache-hit != 'true'
shell: bash
run: |
set -euo pipefail
mkdir -p "$HOME/.local/bin"

# --- wabt (WebAssembly Binary Toolkit) ---
WABT_VERSION=1.0.36
TMP=$(mktemp -d)
curl -sSL "https://github.com/WebAssembly/wabt/releases/download/${WABT_VERSION}/wabt-${WABT_VERSION}-ubuntu-20.04.tar.gz" \
| tar -xz -C "$TMP"
cp "$TMP"/wabt-${WABT_VERSION}*/bin/* "$HOME/.local/bin/"

# --- gotestsum ---
go install gotest.tools/[email protected]
ln -sf "$(go env GOPATH)/bin/gotestsum" "$HOME/.local/bin/gotestsum"

- name: ⏱️ mark — Install dependencies
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tInstall dependencies" >> "$TIMER_FILE"



- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: "24"
cache: yarn
cache-dependency-path: "**/yarn.lock"
- name: ⏱️ mark — Setup Node.js
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tSetup Node.js" >> "$TIMER_FILE"

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: "go.mod"
- name: ⏱️ mark — Setup Go
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tSetup Go" >> "$TIMER_FILE"

- name: Install wasm-ld
run: |
sudo apt-get update && sudo apt-get install -y lld-14
sudo ln -s /usr/bin/wasm-ld-14 /usr/local/bin/wasm-ld
shell: bash
- name: ⏱️ mark — Setup Go
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tSetup wasm-ld" >> "$TIMER_FILE"

- name: Install rust
id: install-rust
uses: ./.github/actions/install-rust
- name: ⏱️ mark — Install rust
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tInstall rust" >> "$TIMER_FILE"

- name: Setup Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
cache: false
version: v1.0.0
- name: ⏱️ mark — Setup Foundry
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tSetup Foundry" >> "$TIMER_FILE"

- name: Install cbindgen
run: cargo install --force cbindgen
shell: bash
- name: ⏱️ mark — Install cbindgen
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tInstall cbindgen" >> "$TIMER_FILE"

- name: Cache Go build
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: ⏱️ mark — Cache Go build
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tCache Go build" >> "$TIMER_FILE"

- name: Cache Rust build
uses: actions/cache@v4
Expand All @@ -59,6 +136,10 @@ runs:
target/etc/initial-machine-cache/
/home/runner/.rustup/toolchains/
key: ${{ runner.os }}-cargo-${{ steps.install-rust.outputs.version }}-${{ hashFiles('arbitrator/Cargo.lock') }}
- name: ⏱️ mark — Cache Rust build
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tCache Rust build" >> "$TIMER_FILE"

- name: Cache cbrotli
id: cache-cbrotli
Expand All @@ -71,13 +152,55 @@ runs:
target/lib/libbrotlienc-static.a
target/lib/libbrotlidec-static.a
key: ${{ runner.os }}-brotli-${{ hashFiles('scripts/build-brotli.sh') }}
- name: ⏱️ mark — Cache cbrotli
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tCache cbrotli" >> "$TIMER_FILE"

- name: Build cbrotli-local
if: steps.cache-cbrotli.outputs.cache-hit != 'true'
run: ./scripts/build-brotli.sh -l
shell: bash
- name: ⏱️ mark — Build cbrotli-local
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tBuild cbrotli-local" >> "$TIMER_FILE"

- name: Build cbrotli-wasm in docker
if: steps.cache-cbrotli.outputs.cache-hit != 'true'
run: ./scripts/build-brotli.sh -w -d
shell: bash
- name: ⏱️ mark — Build cbrotli-wasm in docker
if: always()
shell: bash
run: echo -e "$(date +%s%3N)\tBuild cbrotli-wasm in docker" >> "$TIMER_FILE"

# -------------------- TIMING: SUMMARIZE --------------------
- name: ⏱️ Summarize step timings
if: always()
shell: bash
run: |
python - <<'PY' | tee -a "$GITHUB_STEP_SUMMARY"
import os, sys
tf = os.environ.get("TIMER_FILE")
if not tf or not os.path.exists(tf):
print("No timing data found.")
sys.exit(0)
marks = []
with open(tf, "r") as f:
next(f)
for line in f:
line=line.strip()
if not line: continue
ts,label = line.split("\t", 1)
marks.append((int(ts), label))
print("## ⏱️ Nitro CI Setup — Per-Step Timings")
print()
print("| Step | Duration |")
print("|---|---|")
for i in range(1, len(marks)):
ms = marks[i][0] - marks[i-1][0]
s = ms // 1000
rem = ms % 1000
print(f"| {marks[i][1]} | {s}.{rem:03d}s |")
PY
Loading