build(deps-dev): bump @types/ioredis from 4.28.10 to 5.0.0 in /backend #67
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/CD Pipeline | ||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| REGISTRY: ghcr.io | ||
| # GHCR requires lowercase image names; normalize the owner | ||
| IMAGE_NAME_FRONTEND: ${{ github.repository }}-frontend | ||
| IMAGE_NAME_BACKEND: ${{ github.repository }}-backend | ||
| jobs: | ||
| build-contracts: | ||
| name: Build Smart Contracts | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: stable | ||
| - name: Build contracts (native) | ||
| run: | | ||
| cd contracts | ||
| cargo build --release | ||
| - name: Check wasm target | ||
| run: | | ||
| cd contracts | ||
| rustup target add wasm32-unknown-unknown | ||
| cargo check --target wasm32-unknown-unknown --release | ||
| build-backend: | ||
| name: Build Backend | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Verify lock file | ||
| run: | | ||
| if [ ! -f package-lock.json ]; then | ||
| echo "Error: root package-lock.json is missing. Run 'npm install --package-lock-only' in the project root" | ||
| exit 1 | ||
| fi | ||
| - name: Install dependencies | ||
| run: | | ||
| npm config set fetch-retries 5 | ||
| npm config set fetch-retry-mintimeout 20000 | ||
| npm config set fetch-retry-maxtimeout 120000 | ||
| npm ci -w backend | ||
| - name: Run security audit | ||
| run: npm audit -w backend || true | ||
| - name: Build backend | ||
| run: npm run build -w backend | ||
| build-frontend: | ||
| name: Build Frontend | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| - name: Verify lock file | ||
| run: | | ||
| if [ ! -f package-lock.json ]; then | ||
| echo "Error: root package-lock.json is missing. Run 'npm install --package-lock-only' in the project root" | ||
| exit 1 | ||
| fi | ||
| - name: Install dependencies | ||
| run: | | ||
| npm config set fetch-retries 5 | ||
| npm config set fetch-retry-mintimeout 20000 | ||
| npm config set fetch-retry-maxtimeout 120000 | ||
| npm ci -w frontend | ||
| - name: Run security audit | ||
| run: npm audit -w frontend || true | ||
| - name: Build frontend | ||
| run: npm run build -w frontend | ||
| docker-frontend: | ||
| name: Build & Push Frontend Docker Image | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to GitHub Container Registry | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Lowercase image names (GHCR requirement) | ||
| run: | | ||
| echo "IMAGE_NAME_FRONTEND_LC=$(echo '${{ env.IMAGE_NAME_FRONTEND }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
| echo "IMAGE_NAME_BACKEND_LC=$(echo '${{ env.IMAGE_NAME_BACKEND }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
| - name: Extract metadata for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_FRONTEND_LC }} | ||
| tags: | | ||
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | ||
| type=sha,prefix=,format=short | ||
| type=ref,event=tag | ||
| type=raw,value={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} | ||
| - name: Build and push | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: ./frontend/Dockerfile | ||
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| build-args: | | ||
| BUILD_DATE=${{ github.event.head_commit.timestamp || github.sha }} | ||
| VCS_REF=${{ github.sha }} | ||
| VERSION=${{ steps.meta.outputs.version }} | ||
| docker-backend: | ||
| name: Build & Push Backend Docker Image | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to GitHub Container Registry | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Lowercase image names (GHCR requirement) | ||
| run: | | ||
| echo "IMAGE_NAME_FRONTEND_LC=$(echo '${{ env.IMAGE_NAME_FRONTEND }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
| echo "IMAGE_NAME_BACKEND_LC=$(echo '${{ env.IMAGE_NAME_BACKEND }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
| - name: Extract metadata for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND_LC }} | ||
| tags: | | ||
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | ||
| type=sha,prefix=,format=short | ||
| type=ref,event=tag | ||
| type=raw,value={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} | ||
| - name: Build and push | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: ./backend/Dockerfile | ||
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| build-args: | | ||
| BUILD_DATE=${{ github.event.head_commit.timestamp || github.sha }} | ||
| VCS_REF=${{ github.sha }} | ||
| VERSION=${{ steps.meta.outputs.version }} | ||
| test-e2e: | ||
| name: E2E Tests (Playwright) | ||
| runs-on: ubuntu-latest | ||
| needs: [test-frontend] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' | ||
| cache: 'npm' | ||
| cache-dependency-path: frontend/package-lock.json | ||
| - name: Install dependencies | ||
| run: | | ||
| cd frontend | ||
| npm ci | ||
| - name: Install Playwright browsers | ||
| run: | | ||
| cd frontend | ||
| npx playwright install --with-deps chromium | ||
| - name: Run Playwright tests | ||
| run: | | ||
| cd frontend | ||
| npx playwright test --reporter=json,html,junit | ||
| env: | ||
| CI: true | ||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: playwright-report | ||
| path: frontend/playwright-report/ | ||
| retention-days: 7 | ||
| - name: Upload test results (JSON) | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: playwright-test-results | ||
| path: frontend/test-results/ | ||
| retention-days: 7 | ||
| security-scan: | ||
| name: Security Scan | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| security-events: write | ||
| contents: read | ||
| steps: | ||
| - 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 scan results | ||
| uses: github/codeql-action/upload-sarif@v4 | ||
| with: | ||
| sarif_file: 'trivy-results.sarif' | ||