Merge pull request #312 from stefanprodan/dependabot/go_modules/googl… #600
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'master' | |
permissions: | |
contents: read | |
env: | |
KUBERNETES_VERSION: 1.26.0 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
cache-dependency-path: | | |
**/go.sum | |
**/go.mod | |
- name: Setup kubectl | |
uses: azure/setup-kubectl@v3 | |
with: | |
version: v${{ env.KUBERNETES_VERSION }} | |
- name: Setup kubeconform | |
uses: ./.github/actions/kubeconform | |
- name: Setup Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.10.3 | |
- name: Setup CUE | |
uses: cue-lang/[email protected] | |
- name: Setup Timoni | |
uses: stefanprodan/timoni/actions/setup@main | |
- name: Run unit tests | |
run: make test | |
- name: Validate Helm chart | |
run: | | |
helm lint ./charts/podinfo/ | |
helm template ./charts/podinfo/ | kubeconform -strict -summary -kubernetes-version ${{ env.KUBERNETES_VERSION }} | |
- name: Validate Kustomize overlay | |
run: | | |
kubectl kustomize ./kustomize/ | kubeconform -strict -summary -kubernetes-version ${{ env.KUBERNETES_VERSION }} | |
- name: Verify CUE formatting | |
working-directory: ./timoni/podinfo | |
run: | | |
cue fmt ./.. | |
status=$(git status . --porcelain) | |
[[ -z "$status" ]] || { | |
echo "CUE files are not correctly formatted" | |
echo "$status" | |
git diff | |
exit 1 | |
} | |
- name: Validate Timoni module | |
working-directory: ./timoni/podinfo | |
run: | | |
timoni mod lint . | |
timoni build podinfo . -f test_values.cue | kubeconform -strict -summary -skip=ServiceMonitor -kubernetes-version ${{ env.KUBERNETES_VERSION }} | |
- name: Check if working tree is dirty | |
run: | | |
if [[ $(git diff --stat) != '' ]]; then | |
echo 'run make test and commit changes' | |
exit 1 | |
fi |