diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..545027f --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,49 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: Coverage + +on: + push: + branches: [ "main" ] + +permissions: + contents: read + pull-requests: read + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Run tests with coverage + run: make test + + - name: Upload coverage to Coveralls + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: coverallsapp/github-action@v2 + with: + file: coverage.out + format: golang diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index ddd8713..43acbf4 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -43,5 +43,5 @@ jobs: - name: Build run: go build -v ./... - - name: Test - run: go test -v ./... + - name: Run Test With coverage + run: make test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0c51afb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +coverage.out diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6392637 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +.PHONY: test +test: + rm -rf coverage.out + go test ./... -coverprofile=coverage.out diff --git a/README.md b/README.md index d03dbd7..fb2e3d4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ [![Release](https://img.shields.io/github/release/apache/datasketches-go.svg)](https://github.com/apache/datasketches-go/releases) [![GoDoc](https://godoc.org/github.com/apache/datasketches-go?status.svg)](https://godoc.org/github.com/apache/datasketches-go) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/apache/datasketches-go/blob/master/LICENSE) +[![Coverage Status](https://coveralls.io/repos/github/apache/datasketches-go/badge.svg?branch=main)](https://coveralls.io/github/apache/datasketches-go?branch=main) # Apache® DataSketches™ Core Go Library Component 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 ``` ./build/Dockerfile ./build/run-docker-test.sh -``` \ No newline at end of file +```