Merge remote-tracking branch 'origin/main' into feature/auto-discover… #148
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 'feature/**' | |
| - 'fix/**' | |
| - 'hotfix/**' | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build test image | |
| run: DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile.test -t n8n-openai-bridge-test . | |
| - name: Run all tests (unit + integration + container) with coverage | |
| run: | | |
| docker run --rm \ | |
| -v /var/run/docker.sock:/var/run/docker.sock \ | |
| -v ${{ github.workspace }}:/build-context:ro \ | |
| -e NPM_CONFIG_UPDATE_NOTIFIER=false \ | |
| n8n-openai-bridge-test npm test | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| files: ./coverage/lcov.info | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run ESLint | |
| run: npm run lint | |
| - name: Check Prettier formatting | |
| run: npm run format:check | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile.build | |
| push: false | |
| load: true | |
| tags: n8n-openai-bridge:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Verify Docker image exists | |
| run: docker images | grep n8n-openai-bridge || (echo "Image not found!" && exit 1) | |
| - name: Test Docker image | |
| run: | | |
| docker run -d --name test-container \ | |
| -p 3333:3333 \ | |
| -e BEARER_TOKEN=test-token \ | |
| n8n-openai-bridge:test | |
| # Wait for container to be ready | |
| echo "Waiting for container to start..." | |
| for i in {1..30}; do | |
| if docker logs test-container 2>&1 | grep -q "Server running on port"; then | |
| echo "✓ Container started" | |
| break | |
| fi | |
| if [ $i -eq 30 ]; then | |
| echo "✗ Container failed to start" | |
| docker logs test-container | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| # Check health endpoint | |
| curl -f http://localhost:3333/health || exit 1 | |
| # Cleanup | |
| docker stop test-container | |
| docker rm test-container | |
| security-scan: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| security-events: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| - name: Upload Trivy results to GitHub Security | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: always() | |
| with: | |
| sarif_file: 'trivy-results.sarif' |