@@ -55,26 +55,22 @@ jobs:
5555
5656 - name : Restore base test coverage
5757 id : base-coverage
58+ if : github.event.pull_request.base.sha != ''
5859 uses : actions/cache@v2
5960 with :
6061 path : |
6162 integration-base.txt
6263 # Use base sha for PR or new commit hash for master/main push in test result key.
63- key : ${{ runner.os }}-integration-test-base- coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
64+ key : ${{ runner.os }}-integration-test-coverage-${{ (github.event.pull_request.base.sha != github.event.after) && github.event.pull_request.base.sha || github.event.after }}
6465
65- - name : Checkout base code
66- if : env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
67- uses : actions/checkout@v2
68- with :
69- ref : ${{ github.event.pull_request.base.sha }}
70- path : __base
71- - name : Docker Compose
72- run : (test -f ${{ env.DOCKER_COMPOSE_FILE }} && docker-compose -f ${{ env.DOCKER_COMPOSE_FILE }} up -d && docker ps && docker-compose -f ${{ env.DOCKER_COMPOSE_FILE }} logs) || echo "::warning ::Missing ${{ env.DOCKER_COMPOSE_FILE }} file"
7366 - name : Run test for base code
7467 if : env.RUN_BASE_COVERAGE == 'on' && steps.base-coverage.outputs.cache-hit != 'true' && github.event.pull_request.base.sha != ''
7568 run : |
76- cd __base
77- make | grep test-integration && (make test-integration && go tool cover -func=./integration.coverprofile > ../integration-base.txt) || echo "No test-integration in base"
69+ git fetch origin master ${{ github.event.pull_request.base.sha }}
70+ HEAD=$(git rev-parse HEAD)
71+ git reset --hard ${{ github.event.pull_request.base.sha }}
72+ (make test-integration && go tool cover -func=./integration.coverprofile > integration-base.txt) || echo "No test-integration in base"
73+ git reset --hard $HEAD
7874
7975 - name : Test
8076 id : test
@@ -90,12 +86,11 @@ jobs:
9086 if : github.event.pull_request.base.sha != ''
9187 run : |
9288 git fetch origin master ${{ github.event.pull_request.base.sha }}
93- curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.2 /linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && echo "78146b31ec37ac8037a25d33b0f3c70c85adb0f8b682441b04b3daa518eaa489 gocovdiff" | shasum -c
89+ curl -sLO https://github.com/vearutop/gocovdiff/releases/download/v1.3.4 /linux_amd64.tar.gz && tar xf linux_amd64.tar.gz && shasum -a 256 gocovdiff && echo "b351c67526eefeb0671c82e9271ae984875865eed19e911f40f78348cb98347c gocovdiff" | shasum -c
9490 REP=$(./gocovdiff -cov integration.coverprofile -gha-annotations gha-integration.txt -delta-cov-file delta-cov-integration.txt -target-delta-cov ${TARGET_DELTA_COV})
9591 echo "${REP}"
9692 REP="${REP//$'\n'/%0A}"
9793 cat gha-integration.txt
98- test -e integration-base.txt && cat integration-base.txt
9994 DIFF=$(test -e integration-base.txt && ./gocovdiff -func-cov integration.txt -func-base-cov integration-base.txt || echo "Missing base coverage file")
10095 DIFF="${DIFF//$'\n'/%0A}"
10196 TOTAL=$(cat delta-cov-integration.txt)
0 commit comments