Skip to content

Commit efc22ff

Browse files
committed
ci: add coverage integration using Codecov tool
Signed-off-by: Rosy-Glorious Miki <rmiki@redhat.com>
1 parent a9c71c7 commit efc22ff

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ jobs:
2121
sudo apt-get install -y make tar diffutils bzip2 gzip curl git
2222
- name: Run make
2323
run: make
24+
- name: Upload coverage artifact
25+
uses: actions/upload-artifact@v5
26+
with:
27+
name: coverage
28+
path: test/coverage/coverage.out
2429

2530
test-fedora:
2631
name: Build and test Fedora on multiple runners
@@ -101,3 +106,24 @@ jobs:
101106
choco install -y make diffutils gzip bzip2 git
102107
- name: Build and test
103108
run: bash -c "make"
109+
110+
upload-coverage:
111+
name: Run tests and upload coverage
112+
runs-on: ubuntu-latest
113+
needs: [ test-makefile ]
114+
if: github.event_name == 'pull_request'
115+
steps:
116+
- name: Checkout
117+
uses: actions/checkout@v6
118+
with:
119+
fetch-depth: 0
120+
- name: Download coverage artifact
121+
uses: actions/download-artifact@v8
122+
with:
123+
name: coverage
124+
- name: Upload results to Codecov
125+
uses: codecov/codecov-action@v5
126+
with:
127+
token: ${{ secrets.CODECOV_TOKEN }}
128+
files: ${{ github.workspace }}/test/coverage/coverage.out
129+

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ integration-test: build
7070

7171
unit-test:
7272
mkdir -p $(GOCOVERDIR)
73-
go test $(GOFLAGS) -coverprofile=$(GOCOVERDIR)/unit.out ./...
74-
go tool cover -func=$(GOCOVERDIR)/unit.out
73+
go test $(GOFLAGS) -coverprofile=$(GOCOVERDIR)/coverage.out ./...
74+
go tool cover -func=$(GOCOVERDIR)/coverage.out
7575

7676
test: unit-test integration-test
7777

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![codecov](https://codecov.io/gh/rmiki-dev/tar-diff/graph/badge.svg)](https://codecov.io/gh/rmiki-dev/tar-diff)
2+
13
# tar-diff
24

35
`tar-diff` is a golang library and set of commandline tools to diff and patch tar files.
@@ -40,4 +42,4 @@ The `tar-diff` file format is described in [file-format.md](file-format.md).
4042
## License
4143

4244
`tar-diff` is licensed under the Apache License, Version 2.0. See
43-
[LICENSE](LICENSE) for the full license text.
45+
[LICENSE](LICENSE) for the full license text.

0 commit comments

Comments
 (0)