From e43e48d7ae39ef49bae9e97abd0ff82031eb7160 Mon Sep 17 00:00:00 2001 From: Sergey Bronnikov Date: Wed, 30 Mar 2022 15:18:17 +0300 Subject: [PATCH 1/2] github-ci: add Tarantool 2.x-latest --- .github/workflows/testing.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index a2d99cfa2..3056593dd 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -24,16 +24,24 @@ jobs: - '1.10' - '2.8' - '2.9' + - '2.x-latest' steps: - name: Clone the connector uses: actions/checkout@v2 - - name: Setup tarantool ${{ matrix.tarantool }} + - name: Setup Tarantool (version is not equal to latest 2.x) + if: matrix.tarantool != '2.x-latest' uses: tarantool/setup-tarantool@v1 with: tarantool-version: ${{ matrix.tarantool }} + - name: Setup Tarantool 2.x (latest) + if: matrix.tarantool == '2.x-latest' + run: | + curl -L https://tarantool.io/pre-release/2/installer.sh | sudo bash + sudo apt install -y tarantool tarantool-dev + - name: Setup golang for the connector and tests uses: actions/setup-go@v2 with: From 5e73e4a5424fabcf3f4068260e125e8afc5d61d1 Mon Sep 17 00:00:00 2001 From: Sergey Bronnikov Date: Tue, 22 Mar 2022 13:54:54 +0300 Subject: [PATCH 2/2] github-ci: add Coveralls support Patch adds an additional job to Github Actions that runs tests with enabled code coverage and send information about coverage to Coveralls, see documentation [1]. Coveralls provides a convenient UI for analysis code coverage [2]. 1. https://docs.coveralls.io/go 2. https://coveralls.io/github/tarantool/go-tarantool --- .github/workflows/testing.yml | 13 ++++++++++++- Makefile | 13 +++++++++++++ README.md | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 3056593dd..26d1a24d6 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -25,12 +25,16 @@ jobs: - '2.8' - '2.9' - '2.x-latest' + coveralls: [false] + include: + - tarantool: '2.x-latest' + coveralls: true steps: - name: Clone the connector uses: actions/checkout@v2 - - name: Setup Tarantool (version is not equal to latest 2.x) + - name: Setup Tarantool ${{ matrix.tarantool }} if: matrix.tarantool != '2.x-latest' uses: tarantool/setup-tarantool@v1 with: @@ -52,3 +56,10 @@ jobs: - name: Run tests run: make test + + - name: Run tests, collect code coverage data and send to Coveralls + if: ${{ matrix.coveralls }} + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + make coveralls diff --git a/Makefile b/Makefile index ec51cca52..72959eeaf 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ SHELL := /bin/bash +COVERAGE_FILE := coverage.out .PHONY: clean clean: ( cd ./queue; rm -rf .rocks ) + rm -f $(COVERAGE_FILE) .PHONY: deps deps: clean @@ -12,3 +14,14 @@ deps: clean test: go clean -testcache go test ./... -v -p 1 + +.PHONY: coverage +coverage: + go clean -testcache + go get golang.org/x/tools/cmd/cover + go test ./... -v -p 1 -covermode=count -coverprofile=$(COVERAGE_FILE) + +.PHONY: coveralls +coveralls: coverage + go get github.com/mattn/goveralls + goveralls -coverprofile=$(COVERAGE_FILE) -service=github diff --git a/README.md b/README.md index c10ee8212..0cd576994 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ +[![Coverage Status](https://coveralls.io/repos/github/tarantool/go-tarantool/badge.svg?branch=master)](https://coveralls.io/github/tarantool/go-tarantool?branch=master) + # Client in Go for Tarantool 1.6+ The `go-tarantool` package has everything necessary for interfacing with