name: test on: pull_request: push: branches: - 'master' jobs: test: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Restore Go cache uses: actions/cache@v1 with: path: ~/go/pkg/mod key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-go- - name: Setup Go uses: actions/setup-go@v2 with: go-version: 1.17.x - name: Run unit tests run: make test - name: Setup CUE uses: cue-lang/setup-cue@main - name: Verify CUE formatting working-directory: ./cue run: | cue fmt . status=$(git status . --porcelain) [[ -z "$status" ]] || { echo "CUE files are not correctly formatted" echo "$status" git diff exit 1 } - name: Validate CUE working-directory: ./cue run: cue vet --all-errors --concrete . - name: Check if working tree is dirty run: | if [[ $(git diff --stat) != '' ]]; then echo 'run make test and commit changes' exit 1 fi - name: Validate Helm chart uses: stefanprodan/kube-tools@v1 with: kubectl: 1.19.11 helm: 2.17.0 helmv3: 3.6.0 command: | helmv3 template ./charts/podinfo | kubeval --strict --kubernetes-version 1.19.11 --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master - name: Validate kustomization uses: stefanprodan/kube-tools@v1 with: kubectl: 1.19.11 command: | kustomize build ./kustomize | kubeval --strict --kubernetes-version 1.19.11 --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master kustomize build ./kustomize | conftest test -p .github/policy -