feat: auto-load .env in golden harness; scaffold CI workflow

This commit is contained in:
SinachPat
2026-08-15 18:05:37 +01:00
parent 0d6afab425
commit 9a7058c85b
2 changed files with 35 additions and 0 deletions
+27
View File
@@ -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
+8
View File
@@ -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';