Merge pull request #64 from kaskol10/feat/topology-ui #144
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, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| cache-dependency-path: go.sum | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Cache swag binary | |
| uses: actions/cache@v4 | |
| id: cache-swag | |
| with: | |
| path: ~/go/bin/swag | |
| key: swag-v1.16.6 | |
| - name: Install swag CLI | |
| if: steps.cache-swag.outputs.cache-hit != 'true' | |
| run: go install github.com/swaggo/swag/cmd/swag@latest | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Generate Swagger docs | |
| run: | | |
| export PATH=$PATH:$(go env GOPATH)/bin | |
| swag init -g cmd/api/main.go -o ./docs/swagger | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./... | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.out | |
| flags: unittests | |
| name: codecov-umbrella | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| cache-dependency-path: go.sum | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Cache swag binary | |
| uses: actions/cache@v4 | |
| id: cache-swag | |
| with: | |
| path: ~/go/bin/swag | |
| key: swag-v1.16.6 | |
| - name: Install swag CLI | |
| if: steps.cache-swag.outputs.cache-hit != 'true' | |
| run: go install github.com/swaggo/swag/cmd/swag@latest | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Generate Swagger docs | |
| run: | | |
| export PATH=$PATH:$(go env GOPATH)/bin | |
| swag init -g cmd/api/main.go -o ./docs/swagger | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| cache-dependency-path: go.sum | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/go/pkg/mod | |
| ~/.cache/go-build | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Cache swag binary | |
| uses: actions/cache@v4 | |
| id: cache-swag | |
| with: | |
| path: ~/go/bin/swag | |
| key: swag-v1.16.6 | |
| - name: Install swag CLI | |
| if: steps.cache-swag.outputs.cache-hit != 'true' | |
| run: go install github.com/swaggo/swag/cmd/swag@latest | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Generate Swagger docs | |
| run: | | |
| export PATH=$PATH:$(go env GOPATH)/bin | |
| swag init -g cmd/api/main.go -o ./docs/swagger | |
| - name: Build API | |
| run: | | |
| CGO_ENABLED=0 GOOS=linux go build -o bin/karpenter-optimizer-api ./cmd/api | |
| - name: Build CLI | |
| run: | | |
| CGO_ENABLED=0 GOOS=linux go build -o bin/karpenter-optimizer ./cmd/cli | |
| frontend: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./frontend | |
| run: npm install --prefer-offline --no-audit | |
| - name: Run linter | |
| working-directory: ./frontend | |
| run: npm run lint | |
| - name: Run tests | |
| working-directory: ./frontend | |
| run: npm test -- --coverage --watchAll=false --passWithNoTests | |
| - name: Build | |
| working-directory: ./frontend | |
| run: npm run build | |
| helm-chart: | |
| name: Helm Chart Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: '3.13.0' | |
| - name: Run Helm Lint | |
| run: | | |
| helm lint charts/karpenter-optimizer | |
| - name: Validate Chart Schema | |
| run: | | |
| helm lint charts/karpenter-optimizer --strict | |
| - name: Validate Default Values | |
| run: | | |
| helm template karpenter-optimizer charts/karpenter-optimizer > /dev/null | |