Skip to content
Snippets Groups Projects
Unverified Commit 011b8ce4 authored by maomao's avatar maomao Committed by GitHub
Browse files

Enable race check in ci (#2486)

* remove debug param

* add nightly static code analysis & ut coverage
parent fd633fb6
No related branches found
No related tags found
No related merge requests found
......@@ -39,12 +39,11 @@ jobs:
with:
go-version: 1.18
- name: Formats Check
- name: Formats Check
run: |
cd $GITHUB_WORKSPACE && make clean
if [ "$(make fmt | grep -v gofmt | wc -l)" -gt 0 ]; then exit 1; fi
- name: Detect non-ascii characters
run: |
na_characters=$(find ${{ github.workspace }} -type f -name "*.go" -exec grep -P '[\xE5-\xE9][\x80-\xBF][\x80-\xBF]|\xE4[\xB8-\xBF][\x80-\xBF]' {} + || true)
......@@ -63,30 +62,11 @@ jobs:
run: |
cd $GITHUB_WORKSPACE
make install-static-check-tools
make static-check &>lint.out
- name: count sca failed files
run: |
cd $GITHUB_WORKSPACE
echo "FAILED_FILES_NUM=$(cat lint.out | grep -E '^pkg|^cmd' | awk -F ".go" '{if(NF>=2) {print $1}}' | sort -u | wc -l)" >> $GITHUB_ENV
make static-check
- name: Unit Testing
timeout-minutes: 60
run: |
if [[ 'schedule' == ${{ github.event_name }} ]]; then
make ut
else
make ut SKIP_TEST="race"
fi
- name: calc pkg code coverage
run: |
cd $GITHUB_WORKSPACE
echo "CODE_COVERAGE=$(awk '{if ($3>1) covered[$1] = true; all[$1] = true} END {print length(covered) / length(all)}' profile.raw)" >> $GITHUB_ENV
- name: get requested reviewers
run: |
echo "ASSIGNEES=${{ join(github.event.pull_request.requested_reviewers.*.login, ',') }}" >> $GITHUB_ENV
make ut
- name: Build Verification Testing
run: |
......
......@@ -57,17 +57,34 @@ jobs:
- name: Unit Testing
timeout-minutes: 60
run: |
make ut SKIP_TEST="race"
cd $GITHUB_WORKSPACE
test_scope=$(go list ./...)
leave_out=$(egrep -lr --include="*.go" 'Code generated by protoc-gen-gogo. DO NOT EDIT.' ./pkg/* | sort -u | xargs basename -a)
echo "INF" "Ingore code coverage $(echo ${leave_out[@]}|tr " " "|")"
ut_report="UT-Report.out"
cover_profile='profile.raw'
raw_coverage="coverage.out"
html_coverage="coverage.html"
go test -v -tags matrixone_test -p 1 -covermode=count -coverprofile=$cover_profile -coverpkg=./pkg/... $test_scope | tee ut_report
echo "ut finished"
cat $cover_profile | egrep -v $(echo ${leave_out[*]} | tr " " "|") > $raw_coverage
echo "raw_coverage finished"
go tool cover -o $html_coverage -html=$raw_coverage
echo "html_coverage finished"
rm $cover_profile
rm $raw_coverage
- name: calc pkg code coverage
run: |
cd $GITHUB_WORKSPACE
echo "CODE_COVERAGE=$(awk '{if ($3>1) covered[$1] = true; all[$1] = true} END {print length(covered) / length(all)}' profile.raw)" >> $GITHUB_ENV
- name: Archive Files
run: |
cd ${{ github.workspace }}
tar zcvf code_quality_reports.tar.gz coverage.html lint.out
- name: Upload
id: uploadCoverageFile
uses: fjogeleit/http-request-action@v1
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment