CI: merge cov files of multiple runs

This commit is contained in:
Miao Wang 2021-07-27 11:08:37 +08:00
parent 1bc0285905
commit 8080ed6648

View File

@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go 1.13 - name: Set up Go 1.16
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.13 go-version: 1.16
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
@ -48,27 +48,33 @@ jobs:
sudo cgcreate -a $USER -t $USER -g cpu:tunasync sudo cgcreate -a $USER -t $USER -g cpu:tunasync
sudo cgcreate -a $USER -t $USER -g memory:tunasync sudo cgcreate -a $USER -t $USER -g memory:tunasync
- name: Set up Go 1.13 - name: Set up Go 1.16
uses: actions/setup-go@v1 uses: actions/setup-go@v1
with: with:
go-version: 1.13 go-version: 1.16
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Run Unit tests. - name: Run Unit tests.
run: make test run: |
go install github.com/wadey/gocovmerge@latest
make test
- name: Run Additional Unit tests. - name: Run Additional Unit tests.
run: | run: |
make build-test-worker make build-test-worker
sudo cgexec -g "*:/" bash -c "echo 0 > /sys/fs/cgroup/systemd/tasks; exec sudo -u $USER env USECURCGROUP=1 cgexec -g cpu,memory:tunasync ./worker.test -test.v -test.coverprofile profile.cov -test.run TestCgroup" sudo cgexec -g "*:/" bash -c "echo 0 > /sys/fs/cgroup/systemd/tasks; exec sudo -u $USER env USECURCGROUP=1 cgexec -g cpu,memory:tunasync ./worker.test -test.v -test.coverprofile profile2.cov -test.run TestCgroup"
- name: Combine coverage files
run : |
$HOME/go/bin/gocovmerge profile.cov profile2.cov > profile-all.cov
- name: Convert coverage to lcov - name: Convert coverage to lcov
uses: jandelgado/gcov2lcov-action@v1.0.0 uses: jandelgado/gcov2lcov-action@v1.0.0
with: with:
infile: profile.cov infile: profile-all.cov
outfile: coverage.lcov outfile: coverage.lcov
- name: Coveralls - name: Coveralls