github.com/evdatsion/aphelion-dpos-bft@v0.32.1/.github/workflows/coverage.yml (about) 1 name: Test Coverage 2 on: 3 pull_request: 4 push: 5 branches: 6 - master 7 - release/** 8 9 jobs: 10 split-test-files: 11 runs-on: ubuntu-latest 12 steps: 13 - uses: actions/checkout@v2 14 - name: Create a file with all the pkgs 15 run: go list ./... > pkgs.txt 16 - name: Split pkgs into 4 files 17 run: split -d -n l/4 pkgs.txt pkgs.txt.part. 18 # cache multiple 19 - uses: actions/upload-artifact@v2 20 with: 21 name: "${{ github.sha }}-00" 22 path: ./pkgs.txt.part.00 23 - uses: actions/upload-artifact@v2 24 with: 25 name: "${{ github.sha }}-01" 26 path: ./pkgs.txt.part.01 27 - uses: actions/upload-artifact@v2 28 with: 29 name: "${{ github.sha }}-02" 30 path: ./pkgs.txt.part.02 31 - uses: actions/upload-artifact@v2 32 with: 33 name: "${{ github.sha }}-03" 34 path: ./pkgs.txt.part.03 35 36 tests: 37 runs-on: ubuntu-latest 38 needs: split-test-files 39 strategy: 40 fail-fast: false 41 matrix: 42 part: ["00", "01", "02", "03"] 43 steps: 44 - uses: actions/setup-go@v2 45 with: 46 go-version: '^1.15.4' 47 - uses: actions/checkout@v2 48 - uses: technote-space/get-diff-action@v4 49 with: 50 PATTERNS: | 51 **/**.go 52 go.mod 53 go.sum 54 - uses: actions/download-artifact@v2 55 with: 56 name: "${{ github.sha }}-${{ matrix.part }}" 57 if: env.GIT_DIFF 58 - name: test & coverage report creation 59 run: | 60 cat pkgs.txt.part.${{ matrix.part }} | xargs go test -mod=readonly -timeout 8m -race -coverprofile=${{ matrix.part }}profile.out -covermode=atomic 61 if: env.GIT_DIFF 62 - uses: actions/upload-artifact@v2 63 with: 64 name: "${{ github.sha }}-${{ matrix.part }}-coverage" 65 path: ./${{ matrix.part }}profile.out 66 67 upload-coverage-report: 68 runs-on: ubuntu-latest 69 needs: tests 70 steps: 71 - uses: actions/checkout@v2 72 - uses: technote-space/get-diff-action@v4 73 with: 74 PATTERNS: | 75 **/**.go 76 go.mod 77 go.sum 78 - uses: actions/download-artifact@v2 79 with: 80 name: "${{ github.sha }}-00-coverage" 81 if: env.GIT_DIFF 82 - uses: actions/download-artifact@v2 83 with: 84 name: "${{ github.sha }}-01-coverage" 85 if: env.GIT_DIFF 86 - uses: actions/download-artifact@v2 87 with: 88 name: "${{ github.sha }}-02-coverage" 89 if: env.GIT_DIFF 90 - uses: actions/download-artifact@v2 91 with: 92 name: "${{ github.sha }}-03-coverage" 93 if: env.GIT_DIFF 94 - run: | 95 cat ./*profile.out | grep -v "mode: atomic" >> coverage.txt 96 if: env.GIT_DIFF 97 - uses: codecov/codecov-action@v1.0.15 98 with: 99 file: ./coverage.txt 100 if: env.GIT_DIFF