One more attempt

This commit is contained in:
cte
2025-01-31 22:03:33 -08:00
parent 17fb94cb1b
commit de7f67f71e

View File

@@ -43,15 +43,25 @@ jobs:
- name: Run unit tests - name: Run unit tests
run: npm test run: npm test
check-openrouter-api-key:
runs-on: ubuntu-latest
outputs:
exists: ${{ steps.openrouter-api-key-check.outputs.defined }}
steps:
- name: Check if OPENROUTER_API_KEY exists
id: openrouter-api-key-check
shell: bash
run: |
if [ "${{ secrets.OPENROUTER_API_KEY }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
integration-test: integration-test:
# https://stackoverflow.com/questions/72925899/github-actions-detect-if-secret-exists runs-on: ubuntu-latest
env: needs: [check-openrouter-api-key]
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} if: needs.check-openrouter-api-key.outputs.exists == 'true'
if: ${{ env.OPENROUTER_API_KEY != '' }}
strategy:
matrix:
os: [ubuntu-latest] # macos-latest, windows-latest
runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -64,7 +74,5 @@ jobs:
run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.integration run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.integration
- name: Install dependencies - name: Install dependencies
run: npm run install:all run: npm run install:all
- run: xvfb-run -a npm run test:integration - name: Run integration tests
if: runner.os == 'Linux' run: xvfb-run -a npm run test:integration
- run: npm run test:integration
if: runner.os != 'Linux'