fix: fake types #45
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| gofmt: | |
| name: Go Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5.0.1 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Verify formatting | |
| run: | | |
| if [ -n "$(gofmt -l $(find . -name '*.go'))" ]; then | |
| echo "Go files are not formatted" | |
| exit 1 | |
| fi | |
| go-vet: | |
| name: Go Vet | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5.0.1 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: go vet | |
| run: go vet ./... | |
| go-modernize: | |
| name: Go Modernize | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5.0.1 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install modernize | |
| run: go install golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.20.0 | |
| - name: go modernize | |
| run: modernize -test ./... | |
| go-staticcheck: | |
| name: Staticcheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5.0.1 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install Staticcheck | |
| run: go install honnef.co/go/tools/cmd/staticcheck@2025.1.1 | |
| - name: staticcheck | |
| run: staticcheck ./... | |
| go-test: | |
| name: Go Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5.0.1 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: go test | |
| run: go test ./... | |
| helm-lint: | |
| name: Helm Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4.2.0 | |
| with: | |
| version: v3.13.3 | |
| - name: Helm lint | |
| run: helm lint helm/betterstack-operator | |
| helm-upgrade: | |
| name: Helm Upgrade | |
| runs-on: ubuntu-latest | |
| needs: [helm-lint, build-image] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4.2.0 | |
| with: | |
| version: v3.13.3 | |
| - name: Create kind cluster | |
| uses: helm/kind-action@v1.9.0 | |
| with: | |
| version: v0.20.0 | |
| cluster_name: betterstack-helm-upgrade | |
| - name: Download built image | |
| uses: actions/download-artifact@v4.1.4 | |
| with: | |
| name: betterstack-operator-image | |
| path: . | |
| - name: Load image into Docker | |
| run: docker load --input betterstack-operator-image.tar | |
| - name: Load image into kind | |
| run: kind load docker-image betterstack-operator:test --name betterstack-helm-upgrade | |
| - name: Helm upgrade --install | |
| run: | | |
| helm upgrade --install betterstack-operator ./helm/betterstack-operator \ | |
| --namespace betterstack-operator --create-namespace \ | |
| --set credentials.secret.create=true \ | |
| --set credentials.secret.value=dummy-token \ | |
| --set image.repository=betterstack-operator \ | |
| --set image.tag=test \ | |
| --wait --timeout 5m | |
| build-image: | |
| name: Build Image | |
| runs-on: ubuntu-latest | |
| needs: [gofmt, go-vet, go-modernize, go-staticcheck, go-test, helm-lint] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Build Docker image | |
| run: docker build --file Dockerfile --tag betterstack-operator:test . | |
| - name: Save Docker image | |
| run: docker save betterstack-operator:test -o betterstack-operator-image.tar | |
| - name: Upload Docker image artifact | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: betterstack-operator-image | |
| path: betterstack-operator-image.tar | |
| e2e: | |
| name: End-to-End | |
| runs-on: ubuntu-latest | |
| needs: [gofmt, go-vet, go-modernize, go-staticcheck, go-test, helm-lint] | |
| if: github.event_name != 'pull_request' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4.1.7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5.0.1 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install kind | |
| uses: helm/kind-action@v1.9.0 | |
| with: | |
| version: v0.20.0 | |
| cluster_name: betterstack-e2e | |
| - name: Run e2e | |
| env: | |
| KIND_CLUSTER_NAME: betterstack-e2e | |
| BETTERSTACK_TOKEN: ${{ secrets.BETTERSTACK_TOKEN }} | |
| run: | | |
| if [ -z "$BETTERSTACK_TOKEN" ]; then | |
| echo "BETTERSTACK_TOKEN secret not set; failing" | |
| exit 1 | |
| fi | |
| go test -tags=e2e ./test/e2e -run TestBetterStackOperatorLifecycle -timeout 20m |