chore(release): restore stable release track (#181) #394
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 | |
| paths: | |
| - go.mod | |
| - go.sum | |
| - '**/*.go' | |
| - 'charts/**' | |
| - '.github/workflows/ci.yml' | |
| - 'hack/test-ord-chart.sh' | |
| - 'hack/validate-ord.mjs' | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| ord-validation: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Validate ORD and OpenAPI assets | |
| run: | | |
| npm install --no-save --ignore-scripts \ | |
| @open-resource-discovery/specification@1.16.3 \ | |
| @apidevtools/swagger-parser@12.1.0 \ | |
| ajv@8.20.0 \ | |
| ajv-formats@3.0.1 | |
| node hack/validate-ord.mjs charts/private-llm-operator/files/ord | |
| node hack/test-ord-renderer.mjs | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Go linters (golangci-lint) | |
| run: | | |
| make lint | |
| - name: Unit tests | |
| shell: bash | |
| env: | |
| GOMAXPROCS: 2 | |
| run: | | |
| set -o pipefail | |
| make test | tee test.out | |
| - name: Upload coverage artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: cover.out | |
| - name: Coverage summary in job | |
| shell: bash | |
| run: | | |
| total=$(go tool cover -func=cover.out | awk '/total:/ {print $3}') | |
| echo "## Coverage" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "Total: ${total}" >> "$GITHUB_STEP_SUMMARY" | |
| - name: Generate coverage reports (txt, html, compact md) | |
| shell: bash | |
| run: | | |
| go tool cover -func=cover.out > coverage.txt | |
| go tool cover -html=cover.out -o coverage.html | |
| TOTAL=$(go tool cover -func=cover.out | awk '/total:/ {print $3}') | |
| TOTAL_NUM=$(echo "$TOTAL" | tr -d '%') | |
| TOTAL_INT=${TOTAL_NUM%.*} | |
| FILLED=$(awk -v p="$TOTAL_NUM" 'BEGIN{printf "%d", (p/10)+0.5}') | |
| BAR="" | |
| for i in $(seq 1 10); do | |
| if [ "$i" -le "$FILLED" ]; then BAR="${BAR}█"; else BAR="${BAR}░"; fi | |
| done | |
| if [ "${TOTAL_INT:-0}" -ge 80 ]; then STATUS="✅"; elif [ "${TOTAL_INT:-0}" -ge 60 ]; then STATUS="⚠️"; else STATUS="❌"; fi | |
| echo "### Code Coverage ${STATUS}" > coverage.md | |
| echo "" >> coverage.md | |
| echo "- Total: ${TOTAL} ${BAR}" >> coverage.md | |
| echo "" >> coverage.md | |
| echo "#### Packages (>0%)" >> coverage.md | |
| echo "" >> coverage.md | |
| echo "| Package | Coverage |" >> coverage.md | |
| echo "|---|---|" >> coverage.md | |
| grep -E '^ok[[:space:]]+.+[[:space:]]+[0-9.]+s[[:space:]]+coverage:[[:space:]]+[0-9.]+%[[:space:]]+of[[:space:]]+statements' test.out | \ | |
| grep -v 'coverage: 0.0% ' | \ | |
| awk '{cov=""; for (i=1; i<=NF; i++) if ($i=="coverage:") {cov=$(i+1); break} pkg=$2; gsub("^github.com/apeirora/showroom-msp-private-llm/","",pkg); print "| " pkg " | " cov " |"}' | head -n 12 >> coverage.md | |
| echo "" >> coverage.md | |
| echo "<details><summary>All packages</summary>" >> coverage.md | |
| echo "" >> coverage.md | |
| echo "| Package | Coverage |" >> coverage.md | |
| echo "|---|---|" >> coverage.md | |
| grep -E '^ok[[:space:]]+.+[[:space:]]+[0-9.]+s[[:space:]]+coverage:[[:space:]]+[0-9.]+%[[:space:]]+of[[:space:]]+statements' test.out | \ | |
| awk '{cov=""; for (i=1; i<=NF; i++) if ($i=="coverage:") {cov=$(i+1); break} pkg=$2; gsub("^github.com/apeirora/showroom-msp-private-llm/","",pkg); print "| " pkg " | " cov " |"}' >> coverage.md | |
| echo "</details>" >> coverage.md | |
| - name: Append coverage report to job summary | |
| shell: bash | |
| run: | | |
| echo "## Test & Coverage" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| cat coverage.md >> "$GITHUB_STEP_SUMMARY" | |
| - name: Upload coverage HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html | |
| path: coverage.html | |
| - name: Comment coverage on PR | |
| if: github.event_name == 'pull_request' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| path: coverage.md | |
| - name: Enforce coverage threshold (optional) | |
| shell: bash | |
| run: | | |
| if [ -n "${COVERAGE_MIN}" ]; then | |
| pct=$(go tool cover -func=cover.out | awk '/total:/ {sub(/%/,"",$3); print $3}') | |
| awk -v p="$pct" -v m="$COVERAGE_MIN" 'BEGIN{ if (p+0 < m+0) { printf("Coverage %.2f%% < %.2f%%\n", p, m); exit 1 } }' | |
| else | |
| echo "COVERAGE_MIN not set; skipping coverage gate" | |
| fi | |
| helm-build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| chart: | |
| - private-llm-operator | |
| - private-llm-operator-ocm | |
| - private-llm-pm-integration | |
| - private-llm-sync-agent | |
| - private-llm-msp-app | |
| - private-llm-pm-app | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Install Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Lint, template, and package chart | |
| id: build | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| chart='${{ matrix.chart }}' | |
| chart_dir="charts/${chart}" | |
| chart_name=$(basename "$chart") # chart already name, but keep for clarity | |
| out_dir="dist/${chart_name}" | |
| echo "::group::${chart}" | |
| helm dependency update "$chart_dir" | |
| helm lint "$chart_dir" | |
| helm template "ci-${chart_name}" "$chart_dir" --namespace default >/dev/null | |
| if [ "$chart" = "private-llm-operator" ]; then | |
| bash hack/test-ord-chart.sh | |
| fi | |
| mkdir -p "$out_dir" | |
| helm package "$chart_dir" --destination "$out_dir" | |
| ls -lh "$out_dir" | |
| echo "chart_dir=${out_dir}" >> "$GITHUB_OUTPUT" | |
| echo "chart_name=${chart_name}" >> "$GITHUB_OUTPUT" | |
| echo "::endgroup::" |