feat: auto-load .env in golden harness; scaffold CI workflow
This commit is contained in:
@@ -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
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { mkdirSync, writeFileSync } from 'node:fs';
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
||||||
import { dirname, join } from 'node:path';
|
import { dirname, join } from 'node:path';
|
||||||
|
import { loadEnvFile } from 'node:process';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { detectBuilder } from './builder-detect.ts';
|
import { detectBuilder } from './builder-detect.ts';
|
||||||
import { asGrokResponse, expectedCalls } from './expected-calls.ts';
|
import { asGrokResponse, expectedCalls } from './expected-calls.ts';
|
||||||
@@ -9,6 +10,13 @@ import { loadSite } from './load-site.ts';
|
|||||||
import { scoreGrokResponse } from './score.ts';
|
import { scoreGrokResponse } from './score.ts';
|
||||||
|
|
||||||
const goldenRoot = join(dirname(fileURLToPath(import.meta.url)), '..');
|
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 {
|
function provider(): LlmProvider {
|
||||||
return process.env.LLM_PROVIDER === 'openrouter' ? 'openrouter' : 'grok';
|
return process.env.LLM_PROVIDER === 'openrouter' ? 'openrouter' : 'grok';
|
||||||
|
|||||||
Reference in New Issue
Block a user