Skip to content

Test select components with 2 levels of nested matrices #89

Test select components with 2 levels of nested matrices

Test select components with 2 levels of nested matrices #89

name: Test select components with 2 levels of nested matrices
on:
# # Uncomment when test added first time to register workflow and comment it back after workflow would be registered
# #
# # Added pull_request to register workflow from the PR.
# # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
# pull_request: {}
workflow_dispatch: {}
permissions:
id-token: write
contents: read
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Setup
run: echo "Do setup"
test:
runs-on: ubuntu-latest
needs: [setup]
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- shell: bash
run: |
mkdir -p ${{ runner.temp }}
cp ./tests/atmos.yaml ${{ runner.temp }}/atmos.yaml
sed -i -e 's#__PLAN_ROLE__#${{ secrets.TERRAFORM_PLAN_ROLE }}#g' ${{ runner.temp }}/atmos.yaml
- uses: ./
id: current
with:
atmos-config-path: "${{ runner.temp }}"
select-filter: '.settings.github.actions_enabled // false'
nested-matrices-count: '2'
outputs:
selected-components: "${{ steps.current.outputs.selected-components }}"
matrix: "${{ steps.current.outputs.matrix }}"
assert:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: nick-fields/assert-action@v2
with:
expected: '[{"component":"test-2","stack":"core-ue2-auto","stack_slug":"core-ue2-auto-test-2"},{"component":"test-4","stack":"plat-ue2-dev","stack_slug":"plat-ue2-dev-test-4"},{"component":"test-5","stack":"plat-ue2-sandbox","stack_slug":"plat-ue2-sandbox-test-5"}]'
actual: "${{ needs.test.outputs.selected-components }}"
- uses: nick-fields/assert-action@v2
with:
expected: '{"include":['
actual: "${{ needs.test.outputs.matrix }}"
comparison: contains
- uses: nick-fields/assert-action@v2
with:
expected: '{"include":[{"name":"core-auto","items":"{\"include\":[{\"component\":\"test-2\",\"stack\":\"core-ue2-auto\",\"stack_slug\":\"core-ue2-auto-test-2\"}]}"},{"name":"plat-dev","items":"{\"include\":[{\"component\":\"test-4\",\"stack\":\"plat-ue2-dev\",\"stack_slug\":\"plat-ue2-dev-test-4\"}]}"},{"name":"plat-sandbox","items":"{\"include\":[{\"component\":\"test-5\",\"stack\":\"plat-ue2-sandbox\",\"stack_slug\":\"plat-ue2-sandbox-test-5\"}]}"}]}'
actual: "${{ needs.test.outputs.matrix }}"