on: pull_request: branches: - main paths-ignore: - "**/*.md" jobs: CI: runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - uses: actions/checkout@v5.0.0 with: persist-credentials: false - uses: actions/setup-go@v6 with: go-version: stable - name: Setup Cue uses: cue-lang/setup-cue@a93fa358375740cd8b0078f76355512b9208acb1 # v1.0.1 with: version: "v0.13.2" - name: Validate the formatting of cue schema files run: make cuefmtcheck - name: Validate the syntax of cue schema files run: make lintcue - name: Validate the security-insights file run: make lintinsights - name: Generate go types from cue schema run: make cuegen - name: Check for missing generated artifacts run: make dirtycheck - name: Vet run: | go vet ./... - name: Unit tests run: | make testcov - name: Quality Gate - Test coverage shall be above threshold env: TESTCOVERAGE_THRESHOLD: 71 run: | echo "Quality Gate: checking test coverage is above threshold ..." echo "Threshold : $TESTCOVERAGE_THRESHOLD %" totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` echo "Current test coverage : $totalCoverage %" if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then echo "OK" else echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." echo "Failed" exit 1 fi