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
| # -------------------------------------------------------------- | |
| # Dispatcher workflow – runs on every push / PR | |
| # -------------------------------------------------------------- | |
| name: Dispatch Framework CI (≤250 per batch) | |
| on: | |
| push: | |
| branches: ['*'] | |
| pull_request: | |
| branches: ['*'] | |
| jobs: | |
| # ------------------------------------------------------------ | |
| # 1️⃣ Build the complete list of language/framework pairs | |
| # ------------------------------------------------------------ | |
| build-list: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| batch‑0: ${{ steps.split.outputs.batch0 }} | |
| batch‑1: ${{ steps.split.outputs.batch1 }} | |
| steps: | |
| - name: Checkout repository (need the whole tree) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate full list of frameworks | |
| id: gen | |
| run: | | |
| # Find every sub‑directory that is exactly two levels deep: | |
| # <language>/<framework> | |
| # and emit JSON objects: {"language":"ruby","framework":"rails"} | |
| LIST=$(find . -mindepth 2 -maxdepth 2 -type d \ | |
| -printf '{"language":"%P","framework":"%f"},' \ | |
| | sed 's/,$//' | jq -s .) | |
| echo "FULL_LIST=$LIST" >> $GITHUB_ENV | |
| echo "::set-output name=full::$LIST" | |
| # -------------------------------------------------------- | |
| # 2️⃣ Split the list into batches of ≤250 items | |
| # -------------------------------------------------------- | |
| - name: Split into batches | |
| id: split | |
| run: | | |
| FULL="${{ steps.gen.outputs.full }}" | |
| TOTAL=$(echo "$FULL" | jq length) | |
| BATCH_SIZE=250 | |
| # Batch 0 – first 250 (or fewer if total <250) | |
| BATCH0=$(echo "$FULL" | jq ".[:$BATCH_SIZE]") | |
| # Batch 1 – the remainder (could be empty) | |
| BATCH1=$(echo "$FULL" | jq ".[$BATCH_SIZE:]") | |
| echo "Batch 0 size: $(echo \"$BATCH0\" | jq length)" | |
| echo "Batch 1 size: $(echo \"$BATCH1\" | jq length)" | |
| echo "::set-output name=batch0::$BATCH0" | |
| echo "::set-output name=batch1::$BATCH1" | |
| env: | |
| FULL: ${{ steps.gen.outputs.full }} | |
| # ------------------------------------------------------------ | |
| # 3️⃣ Run batch 0 (if it contains any items) | |
| # ------------------------------------------------------------ | |
| run-batch-0: | |
| needs: build-list | |
| if: ${{ needs.build-list.outputs.batch-0 != '[]' }} | |
| uses: ./.github/workflows/ci.yml | |
| with: | |
| batch-index: 0 | |
| frameworks-json: ${{ needs.build-list.outputs.batch-0 }} | |
| # ------------------------------------------------------------ | |
| # 4️⃣ Run batch 1 (if it contains any items) | |
| # ------------------------------------------------------------ | |
| run-batch-1: | |
| needs: build-list | |
| if: ${{ needs.build-list.outputs.batch-1 != '[]' }} | |
| uses: ./.github/workflows/ci.yml | |
| with: | |
| batch-index: 1 | |
| frameworks-json: ${{ needs.build-list.outputs.batch-1 }} |