Feat: add sound effects system (#21) #71
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, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| # Cancel in-progress runs for the same workflow and branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Required permissions for Netlify action to comment on PRs/commits | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| deployments: write | |
| statuses: write | |
| jobs: | |
| # Job 1: Code quality checks (fast feedback) | |
| quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run ESLint | |
| run: pnpm lint | |
| - name: Check code formatting | |
| run: pnpm format:check | |
| - name: Type check (if using TypeScript) | |
| run: echo "Add 'pnpm typecheck' when you migrate to TypeScript" | |
| continue-on-error: true | |
| # Job 2: Unit tests with coverage | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run tests | |
| run: pnpm test:run | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=4096 | |
| - name: Generate coverage report | |
| run: pnpm test:coverage | |
| continue-on-error: true | |
| - name: Upload coverage to Codecov | |
| if: matrix.node-version == '20.x' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage/coverage-final.json | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| continue-on-error: true | |
| - name: Comment coverage on PR | |
| if: github.event_name == 'pull_request' && matrix.node-version == '20.x' | |
| uses: romeovs/lcov-reporter-action@v0.3.1 | |
| with: | |
| lcov-file: ./coverage/lcov.info | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| delete-old-comments: true | |
| continue-on-error: true | |
| # Job 3: Build verification | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [quality, test] # Only build if quality and tests pass | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build project | |
| run: pnpm build | |
| env: | |
| VITE_GIT_BRANCH: ${{ github.ref_name }} | |
| VITE_DEV_SITE_URL: 'https://dev-bayanflow.netlify.app' | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| retention-days: 7 | |
| # Job 4: Deploy to Netlify | |
| deploy: | |
| name: Deploy to Netlify | |
| runs-on: ubuntu-latest | |
| needs: [quality, test, build] # Only deploy if all checks pass | |
| if: github.event_name == 'push' || github.event_name == 'pull_request' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| deployments: write | |
| statuses: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build project | |
| run: pnpm build | |
| env: | |
| # embed branch name into Vite build so the frontend can read it at runtime | |
| VITE_GIT_BRANCH: ${{ github.ref_name }} | |
| # optional: clickable dev site URL to use in the badge | |
| VITE_DEV_SITE_URL: 'https://dev-bayanflow.netlify.app' | |
| - name: Deploy to Netlify | |
| id: netlify | |
| uses: nwtgck/actions-netlify@v3.0 | |
| with: | |
| publish-dir: './dist' | |
| production-branch: main | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-message: "Deploy from GitHub Actions (${{ github.ref_name }})" | |
| enable-pull-request-comment: true | |
| enable-commit-comment: true | |
| overwrites-pull-request-comment: true | |
| github-deployment-environment: ${{ github.ref == 'refs/heads/main' && 'production' || github.ref == 'refs/heads/develop' && 'beta' || 'preview' }} | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| # Use the dev site ID when building from develop, otherwise production site ID | |
| NETLIFY_SITE_ID: ${{ github.ref == 'refs/heads/develop' && secrets.NETLIFY_SITE_ID_DEV || secrets.NETLIFY_SITE_ID }} | |
| timeout-minutes: 10 | |
| - name: Output deployment URL | |
| if: always() | |
| run: | | |
| echo "Netlify deploy URL: ${{ steps.netlify.outputs.deploy-url }}" | |
| # Job 5: All checks passed (optional but useful for branch protection) | |
| all-checks-pass: | |
| name: All Checks Passed | |
| runs-on: ubuntu-latest | |
| needs: [quality, test, build, deploy] | |
| if: always() | |
| steps: | |
| - name: Check if all jobs succeeded | |
| run: | | |
| if [[ "${{ needs.quality.result }}" != "success" || "${{ needs.test.result }}" != "success" || "${{ needs.build.result }}" != "success" ]]; then | |
| echo "One or more jobs failed" | |
| exit 1 | |
| fi | |
| echo "All checks passed successfully!" |