name: Build and lint web apps on: workflow_dispatch: pull_request: branches: - "preview" types: - "opened" - "synchronize" - "reopened" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: # Format check has no build dependencies - run immediately in parallel check-format: name: check:format runs-on: ubuntu-latest timeout-minutes: 10 if: | github.event.pull_request.draft == false && github.event.pull_request.requested_reviewers != null env: TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }} TURBO_SCM_HEAD: ${{ github.sha }} steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 50 filter: blob:none - name: Set up Node.js uses: actions/setup-node@v6 - name: Enable Corepack and pnpm run: corepack enable pnpm - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - name: Cache pnpm store uses: actions/cache@v5 with: path: ${{ env.STORE_PATH }} key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | pnpm-store-${{ runner.os }}- - name: Install dependencies run: pnpm install --frozen-lockfile - name: Check formatting run: pnpm turbo run check:format --affected # Build packages - required for lint and type checks build: name: Build packages runs-on: ubuntu-latest timeout-minutes: 15 if: | github.event.pull_request.draft == false && github.event.pull_request.requested_reviewers != null env: TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }} TURBO_SCM_HEAD: ${{ github.sha }} NODE_OPTIONS: "--max-old-space-size=4096" steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 50 filter: blob:none - name: Set up Node.js uses: actions/setup-node@v6 - name: Enable Corepack and pnpm run: corepack enable pnpm - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - name: Cache pnpm store uses: actions/cache@v5 with: path: ${{ env.STORE_PATH }} key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | pnpm-store-${{ runner.os }}- - name: Restore Turbo cache uses: actions/cache/restore@v5 with: path: .turbo key: turbo-${{ runner.os }}-${{ github.event.pull_request.base.sha }}-${{ github.sha }} restore-keys: | turbo-${{ runner.os }}-${{ github.event.pull_request.base.sha }}- turbo-${{ runner.os }}- - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build packages run: pnpm turbo run build --affected - name: Save Turbo cache uses: actions/cache/save@v5 with: path: .turbo key: turbo-${{ runner.os }}-${{ github.event.pull_request.base.sha }}-${{ github.sha }} # Lint check - no build dependency, OxLint is a standalone Rust binary check-lint: name: check:lint runs-on: ubuntu-latest timeout-minutes: 10 if: | github.event.pull_request.draft == false && github.event.pull_request.requested_reviewers != null env: TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }} TURBO_SCM_HEAD: ${{ github.sha }} steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 50 filter: blob:none - name: Set up Node.js uses: actions/setup-node@v6 - name: Enable Corepack and pnpm run: corepack enable pnpm - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - name: Cache pnpm store uses: actions/cache@v5 with: path: ${{ env.STORE_PATH }} key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | pnpm-store-${{ runner.os }}- - name: Install dependencies run: pnpm install --frozen-lockfile - name: Run check:lint run: pnpm turbo run check:lint --affected # Type check depends on build artifacts check-types: name: check:types runs-on: ubuntu-latest needs: build timeout-minutes: 15 env: TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha }} TURBO_SCM_HEAD: ${{ github.sha }} NODE_OPTIONS: "--max-old-space-size=4096" steps: - name: Checkout code uses: actions/checkout@v6 with: fetch-depth: 50 filter: blob:none - name: Set up Node.js uses: actions/setup-node@v6 - name: Enable Corepack and pnpm run: corepack enable pnpm - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - name: Cache pnpm store uses: actions/cache@v5 with: path: ${{ env.STORE_PATH }} key: pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | pnpm-store-${{ runner.os }}- - name: Restore Turbo cache uses: actions/cache/restore@v5 with: path: .turbo key: turbo-${{ runner.os }}-${{ github.event.pull_request.base.sha }}-${{ github.sha }} - name: Install dependencies run: pnpm install --frozen-lockfile - name: Run check:types run: pnpm turbo run check:types --affected