From b21dbd4590b269476623ae8b05b2b82f25f16761 Mon Sep 17 00:00:00 2001 From: ColemanRoo Date: Mon, 27 Jan 2025 11:12:29 -0600 Subject: [PATCH] updating tests and workflow to use OPENROUTER API Key from GHA secrets --- .github/workflows/extension-test.yml | 49 +++++++++++++++------------- src/test/extension.test.ts | 8 ++--- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/.github/workflows/extension-test.yml b/.github/workflows/extension-test.yml index 061dc423b5..24b863260d 100644 --- a/.github/workflows/extension-test.yml +++ b/.github/workflows/extension-test.yml @@ -1,30 +1,35 @@ +name: Extension Test + on: push: - branches: - - feature/integrationTestCI + branches: [ feature/integrationTestCI ] pull_request: - types: [opened, reopened, ready_for_review, synchronize] - branches: [feature/integrationTestCI] + branches: [ feature/integrationTestCI ] workflow_dispatch: jobs: - build: + test: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - - - name: Install dependencies - run: npm run install:all - - - name: Compile TypeScript - run: npm run compile - - name: Run test - run: xvfb-run -a npm run test:extension + steps: + - uses: actions/checkout@v4 + + - name: Create .test_env file + run: | + echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .test_env + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install dependencies + run: npm run install:all + + - name: Compile TypeScript + run: npm run compile + + - name: Run tests + run: xvfb-run -a npm run test:extension + + diff --git a/src/test/extension.test.ts b/src/test/extension.test.ts index 31fe57d0d0..1134095666 100644 --- a/src/test/extension.test.ts +++ b/src/test/extension.test.ts @@ -38,9 +38,9 @@ suite("Roo Code Extension Test Suite", () => { } // Verify API key is set and valid - const apiKey = process.env.OPEN_ROUTER_API_KEY + const apiKey = process.env.OPENROUTER_API_KEY if (!apiKey) { - done(new Error("OPEN_ROUTER_API_KEY environment variable is not set")) + done(new Error("OPENROUTER_API_KEY environment variable is not set")) return } if (!apiKey.startsWith("sk-or-v1-")) { @@ -178,9 +178,9 @@ suite("Roo Code Extension Test Suite", () => { // Set up API configuration await provider.updateGlobalState("apiProvider", "openrouter") await provider.updateGlobalState("openRouterModelId", "anthropic/claude-3.5-sonnet") - const apiKey = process.env.OPEN_ROUTER_API_KEY + const apiKey = process.env.OPENROUTER_API_KEY if (!apiKey) { - assert.fail("OPEN_ROUTER_API_KEY environment variable is not set") + assert.fail("OPENROUTER_API_KEY environment variable is not set") return } await provider.storeSecret("openRouterApiKey", apiKey)