Skip to content

Commit

Permalink
using python to filter test targets
Browse files Browse the repository at this point in the history
  • Loading branch information
abikouo committed Jul 20, 2023
1 parent 441f171 commit 12b98d2
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,22 @@ jobs:
workflow-id: ${{ fromJson(needs.splitter.outputs.test_jobs) }}
name: "integration-${{ matrix.workflow-id }}"
steps:
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: install required python libraries
run: pip install -U jq
shell: bash

- name: Read target
id: read-targets
run: |
TARGETS=$(echo '$ALL_TEST_TARGETS' | jq '."$WORKFLOW_ID"')
echo "ansible_test_targets=${TARGETS}" >> $GITHUB_OUTPUT
shell: bash
import json, os
with open(os.environ.get('GITHUB_OUTPUT'), "a", encoding="utf-8") as fh:
fh.write(f'ansible_test_targets={json.loads(os.environ.get("ALL_TEST_TARGETS")).get(os.environ.get("WORKFLOW_ID"))}\n')
shell: python
env:
ALL_TEST_TARGETS: ${{ needs.splitter.outputs.test_targets_json }}
WORKFLOW_ID: ${{ matrix.workflow-id }}

- name: Display ansible test targets
run: |
echo "ansible_test_targets -> ${{ steps.read-targets.outputs.ansible_test_targets }}"
shell: bash

- name: Checkout collection
uses: actions/checkout@v3
with:
Expand Down

0 comments on commit 12b98d2

Please sign in to comment.