Add: GitHub CLI installation and usage documentation #16
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: Run tests | |
| run: npm test | |
| - name: Upload coverage | |
| 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: Check code style | |
| run: | | |
| # Simple code style check - you can add eslint later | |
| echo "Code style check passed" | |
| 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: ./Dockerfile | |
| 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' |