mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-04-06 02:56:51 +00:00
66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
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.18.x
|
|
- name: Setup CUE
|
|
uses: cue-lang/setup-cue@main
|
|
- name: Run unit tests
|
|
run: make test
|
|
- name: Generate CUE definitions
|
|
run: make cue-mod
|
|
- 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 -
|