potential solution is using matrix strategy. See examples:
example solution from chatgpt:
To restructure this workflow so that all jobs starting with "e2e-" run in a matrix strategy with a max-parallel value of 5, follow these steps:
Consolidate the "e2e-" jobs into a matrix
We will create a job matrix that dynamically runs the e2e- jobs while preserving the custom configuration for each job.
Define the matrix with max-parallel
Use the max-parallel feature to control the maximum number of jobs running concurrently.
Update each e2e- job to work with matrix variables
Here’s how you can restructure the workflow:
Key Changes:
Matrix Creation: All the e2e- jobs are grouped into a matrix under the e2e-tests job.
max-parallel: 5: This ensures that no more than 5 jobs will run concurrently.
Matrix Variables: Each test case (e.g., "Standard", "Mirror Node", etc.) is represented as an object in the matrix with custom properties (npm-test-script, coverage-subdirectory, and coverage-report-name).
Job Execution: The reusable workflow (zxc-e2e-test.yaml) is invoked using the matrix.e2e-test-type variables.
This setup preserves the structure of the individual E2E tests while controlling their parallelism.
potential solution is using matrix strategy. See examples:
example solution from chatgpt:
To restructure this workflow so that all jobs starting with "e2e-" run in a matrix strategy with a max-parallel value of 5, follow these steps:
Consolidate the "e2e-" jobs into a matrix We will create a job matrix that dynamically runs the e2e- jobs while preserving the custom configuration for each job.
Define the matrix with max-parallel Use the max-parallel feature to control the maximum number of jobs running concurrently.
Update each e2e- job to work with matrix variables Here’s how you can restructure the workflow:
defaults: run: shell: bash
jobs: env-vars: name: Set Environment Variables uses: ./.github/workflows/zxc-env-vars.yaml with: custom-job-label: Set Environment Variables
code-style: name: Code Style uses: ./.github/workflows/zxc-code-style.yaml with: custom-job-label: Standard
unit-tests: name: Unit Tests uses: ./.github/workflows/zxc-unit-test.yaml if: ${{ github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' }} needs:
code-style with: custom-job-label: Standard
e2e-tests: name: E2E Tests Matrix if: ${{ github.event_name == 'push' || github.event.inputs.enable-e2e-tests == 'true' }} needs:
name: Run E2E Tests ${{ matrix.e2e-test-type.name }} uses: ./.github/workflows/zxc-e2e-test.yaml with: custom-job-label: ${{ matrix.e2e-test-type.name }} npm-test-script: ${{ matrix.e2e-test-type.npm-test-script }} coverage-subdirectory: ${{ matrix.e2e-test-type.coverage-subdirectory }} coverage-report-name: ${{ matrix.e2e-test-type.coverage-report-name }}
analyze: name: Analyze uses: ./.github/workflows/zxc-code-analysis.yaml needs:
example solution pulling data from JSON
https://github.com/nbusseneau/cilium/blob/7178a98ef9f11bea0e32c68f0bc941d7063ee854/.github/workflows/conformance-ginkgo.yaml#L225-L236
more...
https://github.com/search?q=path%3A.github%2F**%2F*.yaml%20strategy%20matrix%20max-parallel&type=code