Skip to content

Commit

Permalink
Make dynamic tests matrix by finding all test folders
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Franssen <[email protected]>
  • Loading branch information
marcofranssen committed Jan 10, 2023
1 parent 2dae3df commit 299f71f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/helm-chart-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,31 @@ jobs:
outputs:
changed: ${{ steps.list-changed.outputs.changed }}

build-matrix:
name: Build matrix
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

steps:
- name: Checkout
uses: actions/[email protected]

- id: set-matrix
run: |
tests="$(echo -e "default\n$(find .github/tests -maxdepth 1 -type d | grep -Ev 'tests$' | xargs -I % basename % | sort | uniq)")"
tests_json="$(echo "$tests" | jq -c --slurp --raw-input 'split("\n") | map(select(. != ""))')"
echo "tests=$tests_json" >> $GITHUB_OUTPUT
outputs:
tests: ${{ steps.set-matrix.outputs.tests }}

test:
name: Test
runs-on: ubuntu-22.04
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
needs:
- lint-chart
- build-matrix

strategy:
fail-fast: false
Expand All @@ -108,8 +127,7 @@ jobs:
- v1.24.7
- v1.25.3
values:
- default
- upstream-authority-disk
- ${{ fromJson(needs.build-matrix.outputs.tests) }}

steps:
- name: Checkout
Expand Down

0 comments on commit 299f71f

Please sign in to comment.