| 1 |
name: Coverage |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
- v* |
| 8 |
paths: |
| 9 |
- "**/*.go" |
| 10 |
|
| 11 |
jobs: |
| 12 |
coverage: |
| 13 |
if: github.repository != 'v2ray/v2ray-core' |
| 14 |
runs-on: ubuntu-latest |
| 15 |
steps: |
| 16 |
- name: Set up Go 1.x |
| 17 |
uses: actions/setup-go@v2 |
| 18 |
with: |
| 19 |
go-version: ^1.15 |
| 20 |
|
| 21 |
- name: Checkout codebase |
| 22 |
uses: actions/checkout@v2 |
| 23 |
|
| 24 |
- name: Cache go module |
| 25 |
uses: actions/cache@v2 |
| 26 |
id: cache-gomodules |
| 27 |
with: |
| 28 |
path: ~/go/pkg/mod |
| 29 |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 30 |
restore-keys: | |
| 31 |
${{ runner.os }}-go- |
| 32 |
|
| 33 |
- name: Get dependencies |
| 34 |
if: steps.cache-gomodules.outputs.cache-hit != 'true' |
| 35 |
run: go get -v -t -d ./... |
| 36 |
|
| 37 |
- name: Run coverage |
| 38 |
run: | |
| 39 |
chmod u+x ./testing/coverage/coverall.sh |
| 40 |
./testing/coverage/coverall.sh |
| 41 |
|
| 42 |
- name: Upload coverage to Codecov |
| 43 |
uses: codecov/codecov-action@v1 |
| 44 |
with: |
| 45 |
file: ./coverage.txt |
| 46 |
fail_ci_if_error: true |