Skip to content

feat: add helm tests #89

feat: add helm tests

feat: add helm tests #89

Workflow file for this run

name: Lint
on:
pull_request:
# paths:
# - '**.go'
permissions:
contents: read
pull-requests: read
checks: write
jobs:
golangci:
name: golangci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
args: --timeout=8m --verbose
go-test:
name: go test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
- name: Run go tests
run: go test ./...
helm-lint:
name: helm lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.16.4
- name: helm lint
run: |
make helm path=test version=99.99.98
cd test
helm lint .
test-on-cluster:
name: Cluster E2E Test
runs-on: runs-on=${{ github.run_id }}/runner=sw-amd64/cpu=4
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# Needed for controler runtime and goreleaser
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: stable
# - name: Remove arm in goreleaser yaml
# run: |
# echo TODO
- name: Create Snapshot
id: goreleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v1"
args: release --clean --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Helm
uses: azure/[email protected]
with:
version: v3.16.4
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
with:
registry: true
registry_name: kind-registry
registry_port: 5001
registry_enable_delete: true
- name: Run chart-testing (install)
run: |
version="${{ fromJSON(steps.goreleaser.outputs.metadata).version }}-amd64"
echo Using version $version for image version
kind load docker-image --name chart-testing ghcr.io/shopware/shopware-operator:$version
make helm path=test version=99.99.98
cd test
helm lint .
kubectl create namespace test
helm install test --namespace test . --set image.tag="$version"
kubectl wait --namespace test --for=condition=Available --timeout=20s deployment/test-shopware-operator
kubectl get deployment --namespace test -o wide
kubectl rollout status --namespace test deployment/test-shopware-operator --timeout=60s
kubectl get pods --namespace test -o wide
kubectl get pods --namespace test -o=custom-columns='IMAGE:spec.containers[0].image'