64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
name: "tests"
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
KUBECONFIG: ${{ github.workspace }}/.kube/config
|
|
|
|
jobs:
|
|
get_version_matrix:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
|
- 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
|
- name: Set up Go
|
|
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
|
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:
|
|
# Don't cancel all in-progress and queued jobs in the matrix if any job in the matrix fails.
|
|
# That will be helpful to catch any issues related to a particular Terraform version.
|
|
fail-fast: false
|
|
matrix:
|
|
terraform_version: ${{ fromJson(needs.get_version_matrix.outputs.version_matrix) }}
|
|
steps:
|
|
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
|
- name: Set up Go
|
|
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
|
with:
|
|
go-version-file: go.mod
|
|
- uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
|
|
id: kind
|
|
with:
|
|
wait: 2m
|
|
- name: Acceptance Tests
|
|
env:
|
|
KUBE_CONFIG_PATH: ${{ env.KUBECONFIG }}
|
|
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform_version }}
|
|
TF_ACC_TEMP_DIR: ${{ runner.temp }}
|
|
TESTARGS: "-parallel 1"
|
|
run: |
|
|
make testacc
|