Prepares the tool for integration with kubecompare MCP (#12) #1
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: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| - name: Download dependencies | |
| run: make deps | |
| - name: Run tests | |
| run: make test | |
| - name: Generate coverage report | |
| run: make test-coverage | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: build/coverage.html | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| - name: Run go vet | |
| run: make vet | |
| - name: Run go fmt check | |
| run: | | |
| make fmt | |
| git diff --exit-code || (echo "Code is not formatted. Run 'make fmt' locally." && exit 1) | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" | |
| - name: Build binary | |
| run: make build | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: rds-analyzer | |
| path: build/rds-analyzer | |
| analysis: | |
| name: Run Analysis | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: rds-analyzer | |
| path: build/ | |
| - name: Make binary executable | |
| run: chmod +x build/rds-analyzer | |
| - name: Verify binary works | |
| run: build/rds-analyzer --version | |
| - name: Regexp validation fails on intentionally invalid rules (structured error) | |
| run: | | |
| set +e | |
| out=$(build/rds-analyzer -r examples/minimal-valid-rules.yaml --validate-rules-only 2>&1) | |
| code=$? | |
| set -e | |
| if [ "$code" -eq 0 ]; then | |
| echo "Expected non-zero exit for invalid rules; got 0. Output:" | |
| echo "$out" | |
| exit 1 | |
| fi | |
| want='Error: failed to initialize rule engine: invalid regex pattern(s) in rules file(s):' | |
| if ! printf '%s\n' "$out" | grep -Fq "$want"; then | |
| echo "Expected output to contain:" | |
| echo "$want" | |
| echo "--- actual output ---" | |
| echo "$out" | |
| exit 1 | |
| fi | |
| - name: Run analysis with example data for RAN DU | |
| run: | | |
| build/rds-analyzer \ | |
| -i examples/cluster-compare-output-ran-du.json \ | |
| -r examples/example-ran-du-rules.yaml \ | |
| -o text | |
| - name: Run analysis with HTML output for RAN DU | |
| run: | | |
| build/rds-analyzer \ | |
| -i examples/cluster-compare-output-ran-du.json \ | |
| -r examples/example-ran-du-rules.yaml \ | |
| -o html > build/analysis-report-ran-du.html | |
| - name: Run reporting analysis for RAN DU | |
| run: | | |
| build/rds-analyzer \ | |
| -i examples/cluster-compare-output-ran-du.json \ | |
| -r examples/example-ran-du-rules.yaml \ | |
| -m reporting | |
| - name: Upload analysis report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: analysis-report | |
| path: build/analysis-report-ran-du.html |