Skip to content
Draft
Show file tree
Hide file tree
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
20 changes: 12 additions & 8 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
using: composite
steps:
- name: Install Alpha NEXT CLI verification tools
if: runner.os == 'Linux' && inputs.verification == 'true' && (inputs.job == 'verify' || inputs.job == 'promotion')
if: runner.os == 'Linux' && inputs.verification == 'true' && (inputs.job == 'verify' || inputs.job == 'verify-check' || inputs.job == 'verify-test' || inputs.job == 'promotion')
shell: bash
run: |
sudo apt-get update -qq
Expand Down Expand Up @@ -92,7 +92,7 @@ runs:
fi
"$dafny_dir/dafny" --version
echo "$dafny_dir" >> "$GITHUB_PATH"
- if: inputs.verification == 'true' && inputs.job == 'verify' && steps.restore-dafny.outputs.cache-hit != 'true'
- if: inputs.verification == 'true' && (inputs.job == 'verify' || inputs.job == 'verify-check') && steps.restore-dafny.outputs.cache-hit != 'true'
continue-on-error: true
uses: actions/cache/save@v6
with:
Expand Down Expand Up @@ -133,7 +133,7 @@ runs:
env:
JOB: ${{ inputs.job }}
run: |
[[ $JOB != simulate-* ]] || JOB=verify
[[ $JOB != simulate-* && $JOB != verify-check && $JOB != verify-test && $JOB != verify-browser && $JOB != verify-lint ]] || JOB=verify
lock='${{ hashFiles('.nvmrc', 'pnpm-lock.yaml') }}'
named="spec-${{ runner.os }}-${{ runner.arch }}-${JOB}-"
prefix="${named}${lock}-"
Expand Down Expand Up @@ -180,7 +180,10 @@ runs:
run: |
prefix="turbo-$RUNNER_OS-$RUNNER_ARCH-$JOB-"
scope=${FIXTURE_PR:+"${prefix}pr-${FIXTURE_PR}-"}
fallback=
if [[ $JOB == verify-* ]]; then fallback="turbo-$RUNNER_OS-$RUNNER_ARCH-verify-"; fi
echo "fixture-prefix=$scope" >> "$GITHUB_OUTPUT"
echo "verify-fallback=$fallback" >> "$GITHUB_OUTPUT"
echo "key=${scope:-$prefix}$GITHUB_SHA-$GITHUB_RUN_ATTEMPT" >> "$GITHUB_OUTPUT"
- id: restore-turbo-cache
if: steps.turbo-cache.outputs.key != ''
Expand All @@ -191,6 +194,7 @@ runs:
restore-keys: |
${{ steps.turbo-cache.outputs.fixture-prefix }}
turbo-${{ runner.os }}-${{ runner.arch }}-${{ inputs.job }}-
${{ steps.turbo-cache.outputs.verify-fallback }}
- id: fixture-turbo-inventory
if: steps.turbo-cache.outputs.fixture-prefix != '' && startsWith(steps.restore-turbo-cache.outputs.cache-matched-key, steps.turbo-cache.outputs.fixture-prefix)
shell: bash
Expand All @@ -204,7 +208,7 @@ runs:
fi
- id: gen-seed
if: >-
inputs.job == 'verify' && inputs.cache-verification == 'true' &&
(inputs.job == 'verify' || inputs.job == 'verify-check') && inputs.cache-verification == 'true' &&
env.TURBO_CACHE == 'local:rw' && steps.turbo-cache.outputs.key != ''
shell: bash
run: printf 'prefix=turbo-gen-v2-%s-%s-verify-\n' "$RUNNER_OS" "$RUNNER_ARCH" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -334,7 +338,7 @@ runs:
key: ${{ steps.publish-gen-seed.outputs.key }}
- id: lookup-pnpm-store
if: >-
inputs.job == 'verify' && inputs.verification == 'true' && inputs.cache-verification == 'true' &&
(inputs.job == 'verify' || inputs.job == 'verify-check') && inputs.verification == 'true' && inputs.cache-verification == 'true' &&
github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) &&
steps.pnpm-store.outputs.key != '' && steps.restore-pnpm-store.outputs.cache-hit != 'true'
continue-on-error: true
Expand Down Expand Up @@ -384,15 +388,15 @@ runs:
fi
"$evaluator_dir/quint_evaluator" --help
shell: bash
- if: inputs.job == 'verify' && steps.quint-cache.outputs.cache-primary-key != '' && steps.quint-cache.outputs.cache-hit != 'true'
- if: (inputs.job == 'verify' || inputs.job == 'verify-check') && steps.quint-cache.outputs.cache-primary-key != '' && steps.quint-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: ~/.quint/rust-evaluator-${{ steps.quint-evaluator.outputs.version }}
key: ${{ steps.quint-cache.outputs.cache-primary-key }}
- name: Install Chromium
if: inputs.verification == 'true' && inputs.job != 'selftest-b' && inputs.job != 'selftest-c' && inputs.job != 'selftest-rest' && !startsWith(inputs.job, 'simulate-')
if: inputs.verification == 'true' && inputs.job != 'verify-lint' && inputs.job != 'selftest-b' && inputs.job != 'selftest-c' && inputs.job != 'selftest-rest' && !startsWith(inputs.job, 'simulate-')
run: |
node --input-type=module - "${{ inputs.job == 'selftest-a' }}" "${{ inputs.job == 'verify' }}" "${{ inputs.cache-verification == 'true' }}" <<'JS'
node --input-type=module - "${{ inputs.job == 'selftest-a' }}" "${{ inputs.job == 'verify' || inputs.job == 'verify-check' || inputs.job == 'verify-test' || inputs.job == 'verify-browser' || inputs.job == 'verify-examples' }}" "${{ inputs.cache-verification == 'true' }}" <<'JS'
import { installChromium, prepareChromiumShell } from "./vibestack/chromium.ts";
import { hostedCachedFixture } from "./vibestack/selftests/install.ts";
const [fullOnly, verify, cacheVerification] = process.argv.slice(2);
Expand Down
84 changes: 71 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ name: ci
on:
pull_request:
branches: [main, develop]
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main, develop]

concurrency:
group: ci-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_attempt == '1' && github.ref || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
cancel-in-progress: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != format('refs/heads/{0}', github.event.repository.default_branch)) }}

env:
TURBO_TELEMETRY_DISABLED: "1"
Expand All @@ -20,6 +21,7 @@ permissions:

jobs:
verify:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
name: ${{ matrix.name }}
permissions:
actions: read
Expand All @@ -29,8 +31,21 @@ jobs:
fail-fast: false
matrix:
include:
- name: verify
tasks: //#no-bun build typecheck test test:browser check //#lint:js //#lint:css //#analyze //#selftest:docs //#selftest:examples:assistant //#selftest:examples:dashboard //#selftest:examples:fullstack //#selftest:examples:order
- name: verify-check
tasks: check
eliza: true
- name: verify-test
tasks: build typecheck test
eliza: true
- name: verify-browser
tasks: test:browser
eliza: true
- name: verify-lint
tasks: //#no-bun //#lint:js //#lint:css //#analyze
eliza: true
- name: verify-examples
tasks: //#selftest:docs //#selftest:examples:assistant //#selftest:examples:dashboard //#selftest:examples:fullstack //#selftest:examples:order
eliza: false
environment: &cache-environment ${{ github.event_name == 'push' && 'turbo-cache-publish' || 'turbo-cache-read' }}
env: &cache-env
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
Expand All @@ -41,8 +56,32 @@ jobs:
uses: ./.github/actions/setup
with:
job: ${{ matrix.name }}
- if: matrix.name == 'verify'
- id: eliza-cache-key
if: matrix.eliza == true
shell: bash
run: |
commit=$(node -p 'JSON.parse(require("node:fs").readFileSync("eliza.lock.json", "utf8")).commit')
[[ $commit =~ ^[0-9a-f]{40}$ ]] || exit 0
short=${commit:0:12}
node_ver=$(tr -d '[:space:]' < .nvmrc)
cache_base=$(node -p '(process.env.XDG_CACHE_HOME ?? "").trim() || require("node:path").join(require("node:os").homedir(), ".cache")')
printf 'dir=%s/alpha/eliza-vibestack/%s\nkey=eliza-checkout-v1-%s-%s-%s-%s\n' \
"$cache_base" "$short" "$RUNNER_OS" "$RUNNER_ARCH" "$node_ver" "$commit" >> "$GITHUB_OUTPUT"
- id: restore-eliza-checkout
if: steps.eliza-cache-key.outputs.key != ''
continue-on-error: true
uses: actions/cache/restore@v6
with:
path: ${{ steps.eliza-cache-key.outputs.dir }}
key: ${{ steps.eliza-cache-key.outputs.key }}
- if: matrix.eliza == true
run: pnpm eliza
- if: matrix.name == 'verify-check' && steps.eliza-cache-key.outputs.key != '' && steps.restore-eliza-checkout.outputs.cache-hit != 'true'
continue-on-error: true
uses: actions/cache/save@v6
with:
path: ${{ steps.eliza-cache-key.outputs.dir }}
key: ${{ steps.eliza-cache-key.outputs.key }}
- id: tool-selftest-cache
if: startsWith(matrix.name, 'selftest-') && (env.TURBO_CACHE == 'local:rw' || github.event_name == 'push')
continue-on-error: true
Expand Down Expand Up @@ -89,11 +128,11 @@ jobs:
rm -f ".turbo/cache/$HASH-manifest.json"
mv "$archive" "$meta" .turbo/cache/
- name: Materialize UI stories before tests
if: github.repository == 'lalalune/vibestack' && matrix.name == 'verify'
if: github.repository == 'lalalune/vibestack' && (matrix.name == 'verify' || matrix.name == 'verify-check')
continue-on-error: true
run: node vibestack/spec.ts tasks '@repo/ui#gen'
- id: simulation-shards
if: matrix.name == 'verify' && github.repository != 'lalalune/vibestack'
if: (matrix.name == 'verify' || matrix.name == 'verify-check') && github.repository != 'lalalune/vibestack'
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand All @@ -107,7 +146,7 @@ jobs:
sleep 60
done
- id: simulations
if: matrix.name == 'verify' && github.repository != 'lalalune/vibestack'
if: (matrix.name == 'verify' || matrix.name == 'verify-check') && github.repository != 'lalalune/vibestack'
continue-on-error: true
uses: actions/download-artifact@v8
with:
Expand Down Expand Up @@ -150,8 +189,8 @@ jobs:
run: |
read -ra tasks <<< "$TASKS"
options=()
if [[ $JOB == verify ]]; then
options+=(--log-order=stream --concurrency=4)
if [[ $JOB == verify || $JOB == verify-* ]]; then
options+=(--log-order=stream --concurrency=2)
config=.cache/verify-turbo.json
if [[ $GITHUB_REPOSITORY == lalalune/vibestack && -z ${TURBO_ROOT_TURBO_JSON+x} && ! -e turbo.jsonc && ! -L turbo.jsonc &&
-d spec/app && -f apps/app/package.json && ! -e apps/app/spec && ! -e apps/app/turbo.json && ! -e apps/app/turbo.jsonc ]] &&
Expand Down Expand Up @@ -238,7 +277,7 @@ jobs:
echo 'Skipping the spec cache upload after a full fixture replay.'
- id: superseded-spec-cache
if: >-
cancelled() && matrix.name == 'verify' &&
cancelled() && (matrix.name == 'verify' || matrix.name == 'verify-check') &&
(steps.simulation-shards.conclusion == 'cancelled' ||
steps.verify-tasks.conclusion == 'cancelled') &&
steps.setup.outputs.spec-cache-key != '' &&
Expand Down Expand Up @@ -271,6 +310,7 @@ jobs:
echo "Skipping verification cache uploads for closed PR #$number."
- if: >-
always() && steps.setup.outputs.spec-cache-key != '' &&
matrix.name != 'verify-test' && matrix.name != 'verify-browser' && matrix.name != 'verify-lint' &&
steps.superseded-spec-cache.outputs.skip != 'true' && steps.task-timings.outputs.skip-spec-cache != 'true' &&
steps.closed-pr-cache.outputs.skip != 'true'
uses: actions/cache/save@v6
Expand Down Expand Up @@ -346,7 +386,7 @@ jobs:
include-hidden-files: true

vibestack-precompute-simulations:
if: github.repository != 'lalalune/vibestack'
if: github.repository != 'lalalune/vibestack' && (github.event_name != 'pull_request' || !github.event.pull_request.draft)
name: simulate-${{ matrix.shard }}
permissions:
actions: read
Expand Down Expand Up @@ -547,6 +587,7 @@ jobs:
retention-days: 1

changes:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
outputs:
selftests: ${{ steps.selftests.outputs.run }}
Expand Down Expand Up @@ -575,7 +616,7 @@ jobs:
vibestack-fixture-selftests:
name: ${{ matrix.name }}
needs: changes
if: ${{ !cancelled() && needs.changes.outputs.selftests != 'false' }}
if: ${{ !cancelled() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) && needs.changes.outputs.selftests != 'false' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -593,8 +634,25 @@ jobs:
env: *cache-env
steps: *verification-steps

queue-launcher-release:
verify-gate:
name: verify
needs: [verify, vibestack-precompute-simulations, vibestack-fixture-selftests]
if: ${{ !cancelled() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
runs-on: ubuntu-latest
steps:
- name: Require every verification shard to succeed
env:
VERIFY_RESULT: ${{ needs.verify.result }}
SIMULATE_RESULT: ${{ needs.vibestack-precompute-simulations.result }}
SELFTEST_RESULT: ${{ needs.vibestack-fixture-selftests.result }}
run: |
echo "verify=$VERIFY_RESULT simulate=$SIMULATE_RESULT selftests=$SELFTEST_RESULT"
[[ $VERIFY_RESULT == success ]] || exit 1
[[ $SIMULATE_RESULT == success || $SIMULATE_RESULT == skipped ]] || exit 1
[[ $SELFTEST_RESULT == success || $SELFTEST_RESULT == skipped ]] || exit 1

queue-launcher-release:
needs: [verify-gate, verify, vibestack-precompute-simulations, vibestack-fixture-selftests]
if: success() && github.event_name == 'push' && github.repository_id == '1396333361' && github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
permissions:
Expand Down
9 changes: 1 addition & 8 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@
},
"check": {
"dependsOn": [
"build",
"typecheck",
"test",
"test:browser"
"build"
],
"cache": false
},
Expand Down Expand Up @@ -562,20 +559,16 @@
"//#test",
"@repo/app#build",
"@repo/app#typecheck",
"@repo/app#test",
"@repo/app#test:browser",
"@repo/eliza-harness#build",
"@repo/eliza-harness#typecheck",
"@repo/eliza-harness#test",
"@repo/agent#build",
"@repo/agent#typecheck",
"@repo/agent#test",
"@repo/deployment#build",
"@repo/deployment#typecheck",
"@repo/deployment#test",
"@repo/cloud#build",
"@repo/cloud#typecheck",
"@repo/cloud#test",
"@repo/site#build",
"@repo/site#typecheck",
"@repo/site#test"
Expand Down
16 changes: 15 additions & 1 deletion vibestack/selftests/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,23 @@ describe("the documents name what exists", () => {
assert.deepEqual(toolTitles.map((title) => [title, ranBy(toolSource, title)]),
toolTitles.map((title) => [title, [inShards[title] ?? "selftest:tools:rest"]]));
const ci = read(".github/workflows/ci.yml");
const ciDoc = parseDocument(ci);
const jobs = [...ci.matchAll(/^ +tasks: (.+)$/gm)].flatMap(([, tasks]) => tasks.split(" "));
assert.deepEqual(jobs.sort(), listed("verify").sort(), "CI's jobs run the tasks of pnpm verify between them, each once");
assert.match(ci, /- if: matrix\.name == 'verify'\n +run: pnpm eliza\n[\s\S]+?- id: verify-tasks\b/);
assert.match(ci, /- if: matrix\.eliza == true\n +run: pnpm eliza\n[\s\S]+?- id: verify-tasks\b/);
const verifyMatrix = ciDoc.getIn(["jobs", "verify", "strategy", "matrix", "include"]);
assert.ok(isSeq(verifyMatrix) && verifyMatrix.items.length > 0, "CI declares verify matrix shards");
const elizaTasks = new Set(["build", "typecheck", "test", "test:browser", "check", "//#lint:js", "//#analyze"]);
for (const entry of verifyMatrix.toJSON() as { name: string; tasks: string; eliza?: boolean }[]) {
if (entry.tasks.split(" ").some((task) => elizaTasks.has(task))) {
assert.equal(entry.eliza, true, `CI shard ${entry.name} prepares Eliza before running ${entry.tasks}`);
}
}
const prTypes = ciDoc.getIn(["on", "pull_request", "types"]);
assert.ok(isSeq(prTypes) && (prTypes.toJSON() as string[]).includes("ready_for_review"), "CI triggers when a draft PR becomes ready for review");
assert.equal(ciDoc.getIn(["jobs", "verify-gate", "name"]), "verify", "CI preserves a single aggregate verify gate job name");
const gateNeeds = ciDoc.getIn(["jobs", "verify-gate", "needs"]);
assert.ok(isSeq(gateNeeds) && (gateNeeds.toJSON() as string[]).includes("verify"), "verify gate requires all verify shards");
const release = read(".github/workflows/release.yml");
assert.match(scripts.prepare, /^node vibestack\/spec\.ts gen --install --skip-gen-on-pack \/\/#build(?: |$)/);
if (/^ +- run: pnpm selftest --only --concurrency=1$/m.test(release)) {
Expand Down
Loading