diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 106ab78..de1434c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,7 @@ on: branches: [main] jobs: - validate: + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -22,8 +22,60 @@ jobs: - name: Biome check run: pnpm run lint + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + - name: TypeScript typecheck run: pnpm run typecheck + unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + - name: Tests run: pnpm run test + + e2e-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - name: E2E tests + env: + OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} + run: | + if [ -z "$OPENROUTER_API_KEY" ]; then + echo "::warning::OPENROUTER_API_KEY is not set; skipping e2e tests." + exit 0 + fi + pnpm run test:e2e diff --git a/tests/unit/conversation-state.test.ts b/tests/unit/conversation-state.test.ts index f4381e1..81c60e2 100644 --- a/tests/unit/conversation-state.test.ts +++ b/tests/unit/conversation-state.test.ts @@ -597,7 +597,9 @@ describe('Conversation State Utilities', () => { it('should stringify error outputs', () => { const result = createRejectedResult('call-1', 'test_tool', 'Something went wrong'); - const formatted = unsentResultsToAPIFormat([result]); + const formatted = unsentResultsToAPIFormat([ + result, + ]); expect(formatted[0]?.output).toBe('{"error":"Something went wrong"}'); }); @@ -609,7 +611,9 @@ describe('Conversation State Utilities', () => { text: 'Hello world', }, ]; - const results = [createUnsentResult('call-1', 'test_tool', contentArray)]; + const results = [ + createUnsentResult('call-1', 'test_tool', contentArray), + ]; const formatted = unsentResultsToAPIFormat(results); @@ -625,7 +629,9 @@ describe('Conversation State Utilities', () => { imageUrl: 'data:image/png;base64,abc123', }, ]; - const results = [createUnsentResult('call-1', 'image_gen', contentArray)]; + const results = [ + createUnsentResult('call-1', 'image_gen', contentArray), + ]; const formatted = unsentResultsToAPIFormat(results); @@ -645,7 +651,9 @@ describe('Conversation State Utilities', () => { imageUrl: 'data:image/png;base64,abc123', }, ]; - const results = [createUnsentResult('call-1', 'image_gen', contentArray)]; + const results = [ + createUnsentResult('call-1', 'image_gen', contentArray), + ]; const formatted = unsentResultsToAPIFormat(results); @@ -657,7 +665,9 @@ describe('Conversation State Utilities', () => { 'item1', 'item2', ]; - const results = [createUnsentResult('call-1', 'test_tool', regularArray)]; + const results = [ + createUnsentResult('call-1', 'test_tool', regularArray), + ]; const formatted = unsentResultsToAPIFormat(results); @@ -665,7 +675,9 @@ describe('Conversation State Utilities', () => { }); it('should stringify empty arrays', () => { - const results = [createUnsentResult('call-1', 'test_tool', [])]; + const results = [ + createUnsentResult('call-1', 'test_tool', []), + ]; const formatted = unsentResultsToAPIFormat(results); @@ -679,7 +691,9 @@ describe('Conversation State Utilities', () => { data: 'test', }, ]; - const results = [createUnsentResult('call-1', 'test_tool', invalidArray)]; + const results = [ + createUnsentResult('call-1', 'test_tool', invalidArray), + ]; const formatted = unsentResultsToAPIFormat(results);