E2E test #1662
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
| # This workflow runs CI checks including building, typechecking, and testing the codebase | |
| # Tests are parallelized to run faster by splitting them into separate jobs that run concurrently | |
| # | |
| # See the workflow visualization in knowledge file | |
| # ``` | |
| name: CI | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| branches: ['main'] | |
| env: | |
| CODEBUFF_GITHUB_ACTIONS: 'true' | |
| NEXT_PUBLIC_CB_ENVIRONMENT: 'local' | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Define reusable job template | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: '1.2.12' | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| node_modules | |
| */node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deps- | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Set Environment Variables | |
| run: | | |
| echo "${{ secrets.ENV_LOCAL }}" > .env.local | |
| - name: Build and typecheck | |
| run: | | |
| bun run build | |
| bun run typecheck-only | |
| # Template for test jobs | |
| test: | |
| needs: build | |
| strategy: | |
| matrix: | |
| package: [npm-app, backend, common] | |
| include: | |
| - package: npm-app | |
| - package: backend | |
| - package: common | |
| name: test-${{ matrix.package }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: '1.2.12' | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| node_modules | |
| */node_modules | |
| packages/*/node_modules | |
| key: ${{ runner.os }}-deps-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-deps- | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Set Environment Variables | |
| run: | | |
| echo "${{ secrets.ENV_LOCAL }}" > .env.local | |
| - name: Run ${{ matrix.package }} tests | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 10 | |
| max_attempts: 5 | |
| command: cd ${{ matrix.package }} && bun test $(find src -name *.test.ts) | |
| # - name: Open interactive debug shell | |
| # if: ${{ failure() }} | |
| # uses: mxschmitt/action-tmate@v3 | |
| # timeout-minutes: 15 # optional guard |