Merge pull request #3 from jpower432/feat/helpers #11
Workflow file for this run
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
| on: | ||
|
Check failure on line 1 in .github/workflows/ci.yml
|
||
| pull_request: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| CI: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - uses: actions/checkout@actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 | ||
| with: | ||
| go-version: stable | ||
| # This stopped working with the addition of in-schema conditional validation logic | ||
| # Leaving as a comment temporarily in hopes that we can come back to this soon | ||
| # If you see this 30+ days after it's been commented out, please make a PR to remove | ||
| # - name: Setup Cue | ||
| # uses: cue-lang/setup-cue@a93fa358375740cd8b0078f76355512b9208acb1 # v1.0.1 | ||
| # with: | ||
| # version: v0.15.1 | ||
| # - name: Regenerate types from Gemara spec | ||
| # run: | | ||
| # make generate | ||
| # - name: Check for uncommitted changes | ||
| # run: | | ||
| # if [ -n "$(git status --porcelain)" ]; then | ||
| # echo "Error: Generated types are out of sync with the Gemara specification" | ||
| # echo "The following files have uncommitted changes:" | ||
| # git status --porcelain | ||
| # echo "" | ||
| # echo "Please run 'make generate' locally and commit the changes." | ||
| # exit 1 | ||
| # else | ||
| # echo "Generated types are in sync with the Gemara specification" | ||
| # fi | ||
| - 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 | ||