Skip to content

Commit

Permalink
ci: support coveralls
Browse files Browse the repository at this point in the history
The patch adds an action that installs gcovr and a workflow that runs
regression test suites, produces a summary of current code coverage and
sends code coverage data to Coveralls. Coveralls is a web service that
lets you inspect every detail of your coverage. See Tarantool's LuaJIT
page on Coveralls [1].

1. https://coveralls.io/github/tarantool/luajit
  • Loading branch information
ligurio authored and igormunkin committed Aug 15, 2023
1 parent 1a4c3d4 commit f4d69ab
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/actions/setup-gcovr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Setup gcovr

Action setups the gcovr tool on Linux runners.

## How to use Github Action from Github workflow

Add the following code to the running steps before LuaJIT configuration:
```
- uses: ./.github/actions/setup-gcovr
```
9 changes: 9 additions & 0 deletions .github/actions/setup-gcovr/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Setup gcovr
description: Setup gcovr
runs:
using: composite
steps:
- name: Install gcovr and dependencies
run: |
pip3 install gcovr==6.0
shell: bash
64 changes: 64 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Code coverage

on:
push:
branches-ignore:
- '**-notest'
- 'upstream-**'
tags-ignore:
- '**'

concurrency:
# An update of a developer branch cancels the previously
# scheduled workflow run for this branch. However, the default
# branch, and long-term branch (tarantool/release/2.11,
# tarantool/release/2.10, etc) workflow runs are never canceled.
#
# We use a trick here: define the concurrency group as 'workflow
# run ID' + # 'workflow run attempt' because it is a unique
# combination for any run. So it effectively discards grouping.
#
# XXX: we cannot use `github.sha` as a unique identifier because
# pushing a tag may cancel a run that works on a branch push
# event.
group: ${{ startsWith(github.ref, 'refs/heads/tarantool/')
&& format('{0}-{1}', github.run_id, github.run_attempt)
|| format('{0}-{1}', github.workflow, github.ref) }}
cancel-in-progress: true

jobs:
coverage:
strategy:
fail-fast: false
runs-on: [self-hosted, regular, x86_64, Linux]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: setup Linux
uses: ./.github/actions/setup-linux
- name: install gcovr
uses: ./.github/actions/setup-gcovr
- name: configure
run: >
cmake -S . -B ${{ env.BUILDDIR }}
-G Ninja
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DLUAJIT_ENABLE_COVERAGE=ON
-DLUAJIT_ENABLE_GC64=ON
- name: build
run: cmake --build . --parallel
working-directory: ${{ env.BUILDDIR }}
- name: run regression tests
run: cmake --build ${{ env.BUILDDIR }} --parallel --target LuaJIT-test
- name: generate code coverage report
run: cmake --build ${{ env.BUILDDIR }} --parallel --target LuaJIT-coverage
- name: send code coverage to coveralls.io
run: |
curl -LO https://coveralls.io/coveralls-linux.tar.gz
tar xvzf coveralls-linux.tar.gz
./coveralls -f ./coverage/luajit.xml
working-directory: ${{ env.BUILDDIR }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f4d69ab

Please sign in to comment.