ci: Add checkout #13
This file contains 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: Dynamic Matrix Workflow | |
on: | |
push: | |
branches: | |
- main | |
- ci/test-automation | |
jobs: | |
prepare-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
dynamic-matrix: ${{ steps.convert-to-json.outputs.matrix }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Convert YAML to JSON | |
id: convert-to-json | |
run: | | |
json_output=$(yq eval -o=json .github/data/region.yml) | |
matrix_json=$(echo $json_output | jq -r '.regions | to_entries | map(.key as $service | .value[] | {service: $service, region: .}) | @json') | |
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT | |
run-instances: | |
needs: prepare-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
region_service: ${{ fromJSON(needs.prepare-matrix.outputs.dynamic-matrix) }} | |
steps: | |
- name: Display matrix values | |
run: | | |
echo "Running for service: ${{ matrix.region_service.service }}" | |
echo "Running in region: ${{ matrix.region_service.region }}" | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Execute Testing Workflow | |
uses: ./.github/workflows/execute.yml | |
with: | |
agent: ${{ matrix.region_service.agent }} | |
region: ${{ matrix.region_service.region }} |