feat: Add workflow_dispatch support for manual releases and dry run o… #5
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: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| - name: Run go fmt check | |
| run: | | |
| # Check formatting on our code only (exclude lib/) | |
| UNFMT=$(gofmt -s -l ./cmd ./pkg ./api) | |
| if [ -n "$UNFMT" ]; then | |
| echo "The following files are not formatted:" | |
| echo "$UNFMT" | |
| echo "" | |
| echo "Run 'go fmt ./...' to fix" | |
| exit 1 | |
| fi | |
| - name: Run go vet | |
| run: go vet ./cmd/... ./pkg/... ./api/... | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.out ./cmd/... ./pkg/... ./api/... | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| files: coverage.out | |
| fail_ci_if_error: false | |
| continue-on-error: true | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.22" | |
| - name: Build controller | |
| run: go build -v -o bin/controller ./cmd/controller | |
| helm-lint: | |
| name: Helm Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.14.0 | |
| - name: Lint Helm chart | |
| run: helm lint charts/scaler | |
| - name: Template Helm chart | |
| run: helm template scaler charts/scaler > /dev/null | |
| docker-build: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: false | |
| tags: scaler:test |