Waf 7504 generate a certificate trusted by the cluster with the ip #59
Workflow file for this run
This file contains 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: Run code coverage | |
on: pull_request | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.14.0' | |
- name: Generate coverage report | |
env: | |
TESTCOVERAGE_THRESHOLD: 84 | |
run: | | |
GO_FILES=$(go list ./... |grep -v 'vendor|e2e') | |
echo $GO_FILES | xargs -t -n4 go test -coverprofile=coverage.out -covermode=count -cover -timeout=30s -parallel=4 | |
BASE_TOTAL=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%') | |
if (( $(echo "$BASE_TOTAL $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 > $2)}') )); then | |
echo "OK" | |
else | |
echo "Test coverage is below threshold" | |
fi | |
echo "BASE_TOTAL=$BASE_TOTAL" >> "$GITHUB_ENV" | |
- name: Checkout to the target | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.base_ref }} | |
- name: Generate coverage report | |
run: | | |
GO_FILES=$(go list ./... |grep -v 'vendor|e2e') | |
echo $GO_FILES | xargs -t -n4 go test -coverprofile=coverage.out -covermode=count -cover -timeout=30s -parallel=4 | |
TARGET_TOTAL=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%') | |
if (( $(echo "${{ env.BASE_TOTAL }} $TARGET_TOTAL" | awk '{print ($1 >= $2)}') )); then | |
echo "OK" | |
else | |
echo "Test coverage is below coverage on the target branch" | |
fi | |
echo "TARGET_TOTAL=$TARGET_TOTAL" >> "$GITHUB_ENV" | |
echo "${{ github.event.number }}\nsrc branch coverage: ${{ env.BASE_TOTAL }}\ntarget branch coverage: $TARGET_TOTAL" >> pr_comment.out | |
- name: Save PR comment as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pr_comment | |
path: pr_comment.out | |
retention-days: 1 | |
- name: Fail build on low coverage | |
run: | | |
if (( $(echo "${{ env.BASE_TOTAL }} ${{ env.TARGET_TOTAL }} $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 < $2 || $1 < $3)}') )); then | |
exit 1; | |
fi |