Skip to content

Commit

Permalink
add option to dynamically defined the number of integration jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Jul 10, 2023
1 parent 71b92bc commit 1b7276b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ jobs:
outputs:
test_targets: ${{ steps.display.outputs.test_targets }}
steps:
- name: Determines number of jobs to run integration tests
id: determine-workflow
run: |
import os, re
total_jobs = os.environ.get('AWS_INTEGRATION_TOTAL_JOBS')
for line in os.environ.get('PR_BODY'):
if m := re.match(r"^GHA_SPLITTER_TOTAL_JOBS=(\d+)$", i):
total_jobs = m.group(1)
output_path = os.environ.get('GITHUB_OUTPUT')
with open(output_path, "a", encoding="utf-8") as fw:
fw.write(f'total_jobs={total_jobs}\n')
shell: python
env:
PR_BODY: "${{ github.event.pull_request.body }}"

- name: Checkout repository
uses: ansible-network/github_actions/.github/actions/checkout_dependency@main
with:
Expand All @@ -42,7 +57,7 @@ jobs:
id: splitter
uses: ansible-network/github_actions/.github/actions/ansible_test_splitter@main
with:
total_jobs: ${{ env.AWS_INTEGRATION_TOTAL_JOBS }}
total_jobs: ${{ steps.determine-workflow.outputs.total_jobs }}
collections_to_test: |
${{ env.community_dir }}
${{ env.amazon_dir }}
Expand Down

0 comments on commit 1b7276b

Please sign in to comment.