Release PR #2098
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: ForgeRock Pull Request CI | |
| on: | |
| pull_request: | |
| env: | |
| NX_CLOUD_ENCRYPTION_KEY: ${{ secrets.NX_CLOUD_ENCRYPTION_KEY }} | |
| NX_CLOUD_ACCESS_TOKEN: ${{ secrets.PR_NX_CLOUD_ACCESS_TOKEN }} # Read Only | |
| NX_CLOUD_DISTRIBUTED_EXECUTION: true | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| CI: true | |
| # recommended to set a concurrency group | |
| concurrency: | |
| group: preview-pages-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pr: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - uses: actions/setup-node@v5 | |
| id: cache | |
| with: | |
| node-version-file: '.node-version' | |
| cache: 'pnpm' | |
| - run: pnpm install --frozen-lockfile | |
| # This line enables distribution | |
| # The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested | |
| - run: pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN" | |
| - run: pnpm nx sync:check | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-playwright- | |
| - run: pnpm exec playwright install | |
| - uses: nrwl/nx-set-shas@v4 | |
| # This line is needed for nx affected to work when CI is running on a PR | |
| - run: git branch --track main origin/main | |
| - run: pnpm exec nx-cloud record -- nx format:check | |
| - run: pnpm exec nx affected -t build typecheck lint test e2e-ci | |
| - run: npx nx-cloud fix-ci | |
| if: always() | |
| - uses: codecov/codecov-action@v5 | |
| with: | |
| directory: ./packages/ | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report | |
| path: | | |
| **/.playwright | |
| **/test-results | |
| retention-days: 30 | |
| - name: Ensure builds run | |
| run: pnpm nx run-many -t build | |
| env: | |
| NX_CLOUD_DISTRIBUTED_EXECUTION: false | |
| - run: pnpm pkg-pr-new publish './packages/*' './packages/sdk-effects/*' --packageManager=pnpm | |
| - name: build docs | |
| run: pnpm generate-docs | |
| - name: preview-docs | |
| uses: rajyan/preview-pages@v1 | |
| with: | |
| source-dir: docs | |
| pr-comment: 'none' | |
| - name: Update comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| message: Deployed ${{ github.sha }} to https://ForgeRock.github.io/ping-javascript-sdk/pr-${{ github.event.number }}/${{github.sha}} branch gh-pages in ForgeRock/ping-javascript-sdk | |
| - name: Download baseline bundle sizes | |
| uses: dawidd6/action-download-artifact@v3 | |
| with: | |
| workflow: publish.yml | |
| branch: main | |
| name: bundle-size-baseline | |
| path: . | |
| if_no_artifact_found: warn | |
| continue-on-error: true | |
| - name: Calculate bundle sizes | |
| id: bundle-analysis | |
| run: | | |
| # Make script executable | |
| chmod +x ./scripts/bundle-sizes.sh | |
| # Check if baseline exists | |
| if [ -f "previous_sizes.json" ]; then | |
| echo "✅ Using baseline size data from main branch" | |
| echo "Baseline data preview:" | |
| cat previous_sizes.json | head -5 | |
| else | |
| echo "⚠️ No baseline size data found - this will be the first measurement" | |
| fi | |
| # Run the bundle size calculation | |
| ./scripts/bundle-sizes.sh | |
| - name: Upload current stats as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bundle-size-stats-pr-${{ github.event.pull_request.number }} | |
| path: | | |
| stats.txt | |
| bundle_size_report.md | |
| retention-days: 7 | |
| - name: Find bundle size comment | |
| id: find-comment | |
| uses: peter-evans/find-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: 'github-actions[bot]' | |
| body-includes: <!-- This comment was auto-generated by GitHub Actions to display bundle size statistics --> | |
| - name: Create or update bundle size comment | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| edit-mode: replace | |
| body: | | |
| <!-- This comment was auto-generated by GitHub Actions to display bundle size statistics --> | |
| ## 📦 Bundle Size Analysis | |
| ${{ steps.bundle-analysis.outputs.stats }} | |
| ### Legend | |
| 🆕 New package | |
| 🔺 Size increased | |
| 🔻 Size decreased | |
| ➖ No change | |
| <details> | |
| <summary>ℹ️ How bundle sizes are calculated</summary> | |
| - **Current Size**: Total gzipped size of all files in the package's `dist` directory | |
| - **Baseline**: Comparison against the latest build from the `main` branch | |
| - **Files included**: All build outputs except source maps and TypeScript build cache | |
| - **Exclusions**: `.map`, `.tsbuildinfo`, and `.d.ts.map` files | |
| </details> | |
| --- | |
| <sub>🔄 Updated automatically on each push to this PR</sub> |