chore(build): migrate monorepo orchestration from nx to turborepo #1538
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: Bundle Size | |
| on: | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: bundle-size-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| measure: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| cache-dependency-path: '**/pnpm-lock.yaml' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Restore Turborepo cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| .turbo | |
| **/.turbo | |
| key: ${{ runner.os }}-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.ref_name }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo-${{ github.workflow }}-${{ github.job }}-${{ github.ref_name }}- | |
| ${{ runner.os }}-turbo-${{ github.workflow }}-${{ github.job }}- | |
| ${{ runner.os }}-turbo- | |
| - name: Build packages (current) | |
| run: pnpm run build:pkg | |
| - name: Measure bundle sizes (current) | |
| run: node scripts/bundle-size-report.mjs --output current.json | |
| - name: Prepare base worktree | |
| run: | | |
| BASE_REF=${CI_LOCAL_BASE_REF:-origin/main} | |
| BASE_PATH=".ci-local-base-${RANDOM}-${RANDOM}" | |
| echo "BASE_REF=$BASE_REF" >> "$GITHUB_ENV" | |
| echo "BASE_PATH=$BASE_PATH" >> "$GITHUB_ENV" | |
| git worktree add "$BASE_PATH" "$BASE_REF" | |
| - name: Restore Turborepo cache (base worktree) | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.BASE_PATH }}/.turbo | |
| key: ${{ runner.os }}-turbo-base-${{ github.workflow }}-${{ github.job }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo-base-${{ github.workflow }}-${{ github.job }}- | |
| ${{ runner.os }}-turbo-base-${{ github.workflow }}- | |
| ${{ runner.os }}-turbo-base- | |
| - name: Install dependencies (base) | |
| run: pnpm install --frozen-lockfile | |
| working-directory: ${{ env.BASE_PATH }} | |
| - name: Build packages (base) | |
| run: pnpm run build:pkg | |
| working-directory: ${{ env.BASE_PATH }} | |
| - name: Measure bundle sizes (base) | |
| run: node scripts/bundle-size-report.mjs --output base.json --packages-dir "${{ env.BASE_PATH }}/packages" | |
| - name: Compare bundle sizes | |
| run: node scripts/bundle-size-report.mjs --compare base.json --current current.json --output stats.txt | |
| - name: Cleanup base worktree | |
| if: always() | |
| run: | | |
| if [ -n "${BASE_PATH:-}" ] && [ -d "${BASE_PATH}" ]; then | |
| git worktree remove --force "${BASE_PATH}" | |
| fi |