Skip to content

Commit b0b17a6

Browse files
authored
Merge pull request apache#107 from proost/ci-report-test-coverage
ci: report test coverage
2 parents 71bae0c + fa3b47e commit b0b17a6

5 files changed

Lines changed: 74 additions & 3 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
name: Coverage
19+
20+
on:
21+
push:
22+
branches: [ "main" ]
23+
24+
permissions:
25+
contents: read
26+
pull-requests: read
27+
28+
jobs:
29+
test:
30+
runs-on: ubuntu-latest
31+
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Setup Go
37+
uses: actions/setup-go@v5
38+
with:
39+
go-version-file: 'go.mod'
40+
41+
- name: Run tests with coverage
42+
run: make test
43+
44+
- name: Upload coverage to Coveralls
45+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
46+
uses: coverallsapp/github-action@v2
47+
with:
48+
file: coverage.out
49+
format: golang

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ jobs:
4343
- name: Build
4444
run: go build -v ./...
4545

46-
- name: Test
47-
run: go test -v ./...
46+
- name: Run Test With coverage
47+
run: make test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
coverage.out

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
.PHONY: test
17+
test:
18+
rm -rf coverage.out
19+
go test ./... -coverprofile=coverage.out

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
[![Release](https://img.shields.io/github/release/apache/datasketches-go.svg)](https://github.com/apache/datasketches-go/releases)
2323
[![GoDoc](https://godoc.org/github.com/apache/datasketches-go?status.svg)](https://godoc.org/github.com/apache/datasketches-go)
2424
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/apache/datasketches-go/blob/master/LICENSE)
25+
[![Coverage Status](https://coveralls.io/repos/github/apache/datasketches-go/badge.svg?branch=main)](https://coveralls.io/github/apache/datasketches-go?branch=main)
2526

2627
# Apache<sup>&reg;</sup> DataSketches&trade; Core Go Library Component
2728
This is the core Go component of the DataSketches library. It contains some of the sketching algorithms and can be accessed directly from user applications.
@@ -98,4 +99,4 @@ A Dockerfile is also provided with the necessary env to build and test the proje
9899
```
99100
./build/Dockerfile
100101
./build/run-docker-test.sh
101-
```
102+
```

0 commit comments

Comments
 (0)