From 57803cffbb64e43ab42bccb7972f18e8959156a8 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Thu, 27 Jul 2023 23:37:55 +0100 Subject: [PATCH] github: Run coverage tests This patch adds a job to the docker workflow to run coverage tests, and upload the results to coveralls. --- .github/workflows/docker.yml | 29 ++++++++++++++++++++++++++++- README.md | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b17872b..781c529 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -26,10 +26,37 @@ jobs: - name: Run tests run: docker run --name test1 chasquid-test make test + coverage: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v3 + with: + go-version: ">=1.20" + - name: Install goveralls + run: go install github.com/mattn/goveralls@latest + - name: Docker info (for debugging) + run: docker info + - name: Build test image + run: docker build -t chasquid-test -f test/Dockerfile . + - name: Run coverage tests + run: docker run --name test1 chasquid-test test/cover.sh + - name: Extract coverage results + run: > + docker cp + test1:/go/src/blitiri.com.ar/go/chasquid/.coverage/final.out + . + - name: Upload coverage results + run: > + goveralls + -coverprofile=final.out + -repotoken=${{ secrets.COVERALLS_TOKEN }} + public-image: runs-on: ubuntu-latest timeout-minutes: 15 - needs: integration + needs: [integration, coverage] if: github.event_name == 'push' steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 915eccc..ed45850 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It's written in [Go](https://golang.org), and distributed under the [![Go tests](https://github.com/albertito/chasquid/actions/workflows/gotests.yml/badge.svg?branch=master)](https://github.com/albertito/chasquid/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/albertito/chasquid)](https://goreportcard.com/report/github.com/albertito/chasquid) -[![Coverage](https://img.shields.io/badge/coverage-next-brightgreen.svg)](https://blitiri.com.ar/p/chasquid/coverage.html) +[![Coverage](https://coveralls.io/repos/github/albertito/chasquid/badge.svg?branch=next)](https://coveralls.io/github/albertito/chasquid?branch=next) [![Docs](https://img.shields.io/badge/docs-reference-blue.svg)](https://blitiri.com.ar/p/chasquid/) [![OFTC IRC](https://img.shields.io/badge/chat-oftc-blue.svg)](https://webchat.oftc.net/?channels=%23chasquid)