Dx 9770 v2 dev #832
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: Run Unit Tests | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| # Emit one matrix leg per plugin (any packages/* dir with a `test` script) so the list | |
| # stays in sync with the workspace with no hard-coded package list. | |
| discover: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| packages: ${{ steps.set.outputs.packages }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Discover plugin packages | |
| id: set | |
| run: | | |
| packages=$(node -e ' | |
| const fs = require("fs"); | |
| const out = []; | |
| for (const d of fs.readdirSync("packages")) { | |
| const f = "packages/" + d + "/package.json"; | |
| if (!fs.existsSync(f)) continue; | |
| const p = JSON.parse(fs.readFileSync(f, "utf8")); | |
| if (!(p.scripts || {}).test) continue; | |
| out.push(d); | |
| } | |
| process.stdout.write(JSON.stringify(out)); | |
| ') | |
| echo "packages=$packages" >> "$GITHUB_OUTPUT" | |
| echo "Discovered packages: $packages" | |
| # One check per package (fail-fast: false) so a failure is attributed to a package at a glance. | |
| test: | |
| needs: discover | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: ${{ fromJson(needs.discover.outputs.packages) }} | |
| name: test (${{ matrix.package }}) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.28.0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.x' | |
| cache: 'pnpm' | |
| - name: Install Dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build ${{ matrix.package }} and its dependencies | |
| run: NODE_ENV=PREPACK_MODE pnpm --filter "./packages/${{ matrix.package }}..." --sort run build | |
| - name: Run ${{ matrix.package }} tests | |
| run: pnpm --filter "./packages/${{ matrix.package }}" run test |