Skip to content

Commit

Permalink
added k8s matrix to the acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
alekc committed Jul 18, 2023
1 parent 8afe722 commit 0b87416
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
41 changes: 23 additions & 18 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,47 @@ jobs:
get_version_matrix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo "${{ steps.get_version_matrix.outputs.terraform_versions }}"
- run: echo "${{ steps.get_version_matrix.outputs.k8s_versions }}"
- uses: actions/checkout@v3
- id: get_version_matrix
shell: bash
run: scripts/get-version-matrix.sh
outputs:
version_matrix: ${{ steps.get_version_matrix.outputs.matrix }}
unit_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Unit tests
env:
GOPATH: /home/runner/go
run: |
make test
make vet
terraform_versions: ${{ steps.get_version_matrix.outputs.terraform_versions }}
k8s_versions: ${{ steps.get_version_matrix.outputs.k8s_versions }}
# unit_test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@master
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version-file: go.mod
# - name: Unit tests
# env:
# GOPATH: /home/runner/go
# run: |
# make test
# make vet
acc_test:
needs: get_version_matrix
runs-on: ubuntu-latest
strategy:
matrix:
terraform_version: ${{ fromJson(needs.get_version_matrix.outputs.version_matrix) }}
k8s_version: ${{ fromJson(needs.get_version_matrix.outputs.k8s_versions) }}
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- uses: helm/kind-action@v1.4.0
- uses: helm/kind-action@v1.8.0
id: kind
with:
wait: 2m
node_image: kindest/node:v${{ matrix.k8s_version }}
- name: Acceptance Tests
env:
KUBE_CONFIG_PATH: ${{ env.KUBECONFIG }}
Expand Down
6 changes: 5 additions & 1 deletion scripts/get-version-matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ function get_latest_version() {
sort -V -r | head -1
}

echo "::set-output name=matrix::[$(get_latest_version v0.12), $(get_latest_version v0.13), $(get_latest_version v0.14), $(get_latest_version v0.15), $(get_latest_version v1.0), $(get_latest_version v1.1), $(get_latest_version v1.2), $(get_latest_version v1.3) $(get_latest_version v1.4) $(get_latest_version v1.5)]"
#echo "::set-output name=terraform_versions::[$(get_latest_version v0.12), $(get_latest_version v0.13), $(get_latest_version v0.14), $(get_latest_version v0.15), $(get_latest_version v1.0), $(get_latest_version v1.1), $(get_latest_version v1.2), $(get_latest_version v1.3) $(get_latest_version v1.4) $(get_latest_version v1.5)]"
#echo "::set-output name=k8s_versions::[1.27.3, 1.26.6, 1.25.11, 1.20.15]"

echo terraform_versions="[$(get_latest_version v0.12), $(get_latest_version v0.13), $(get_latest_version v0.14), $(get_latest_version v0.15), $(get_latest_version v1.0), $(get_latest_version v1.1), $(get_latest_version v1.2), $(get_latest_version v1.3) $(get_latest_version v1.4) $(get_latest_version v1.5)]" >> $GITHUB_OUTPUT
echo k8s_versions='["1.27.3", "1.26.6", "1.25.11", "1.20.15"]' >> $GITHUB_OUTPUT

0 comments on commit 0b87416

Please sign in to comment.