Skip to content

Commit

Permalink
Calculate CI matrix automatically.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnavion committed Aug 5, 2023
1 parent 6deb1cf commit ade9645
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,38 @@ jobs:

steps:
- uses: 'actions/checkout@v3'
- name: 'Run'
run: ./ci/global.sh
- run: ./ci/global.sh


list_versions:
runs-on: 'ubuntu-22.04'

steps:
- uses: 'actions/checkout@v3'
- id: 'run'
run: |
(
printf 'matrix='
./test.sh list-versions | jq --raw-input --null-input --compact-output '[inputs | { version: . }]'
) >"$GITHUB_OUTPUT"
outputs:
matrix: "${{ steps.run.outputs.matrix }}"


per_version:
runs-on: 'ubuntu-22.04'

needs: 'list_versions'

strategy:
fail-fast: false

matrix:
version:
- '1.22'
- '1.23'
- '1.24'
- '1.25'
- '1.26'
- '1.27'
include: "${{ fromJSON(needs.list_versions.outputs.matrix) }}"

steps:
- uses: 'actions/checkout@v3'
- name: 'Run'
run: ./ci/per_version.sh
- run: ./ci/per_version.sh
env:
K8S_OPENAPI_ENABLED_VERSION: "${{ matrix.version }}"
8 changes: 8 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ case "$1" in
exit 0
;;

'list-versions')
for v in "${!K8S_VERSIONS[@]}"; do
echo "$v"
done

exit 0
;;

*)
;;
esac
Expand Down

0 comments on commit ade9645

Please sign in to comment.