From 9a7058c85bc3ff6316397d1da57ec16bcce6e906 Mon Sep 17 00:00:00 2001 From: SinachPat Date: Sat, 15 Aug 2026 18:05:37 +0100 Subject: [PATCH] feat: auto-load .env in golden harness; scaffold CI workflow --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ e2e/golden/src/run-golden.ts | 8 ++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..310b37f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 10.33.0 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - run: pnpm test + + - run: pnpm lint diff --git a/e2e/golden/src/run-golden.ts b/e2e/golden/src/run-golden.ts index 864e09a..de26c73 100644 --- a/e2e/golden/src/run-golden.ts +++ b/e2e/golden/src/run-golden.ts @@ -1,5 +1,6 @@ import { mkdirSync, writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; +import { loadEnvFile } from 'node:process'; import { fileURLToPath } from 'node:url'; import { detectBuilder } from './builder-detect.ts'; import { asGrokResponse, expectedCalls } from './expected-calls.ts'; @@ -9,6 +10,13 @@ import { loadSite } from './load-site.ts'; import { scoreGrokResponse } from './score.ts'; const goldenRoot = join(dirname(fileURLToPath(import.meta.url)), '..'); +const repoRoot = join(goldenRoot, '..', '..'); + +try { + loadEnvFile(join(repoRoot, '.env')); +} catch { + // no .env at repo root — live run will skip +} function provider(): LlmProvider { return process.env.LLM_PROVIDER === 'openrouter' ? 'openrouter' : 'grok';