[Tarantool-patches] [PATCH 2/2 v2] ci: support coveralls

Sergey Bronnikov estetus at gmail.com
Tue Aug 1 21:46:10 MSK 2023


From: Sergey Bronnikov <sergeyb at tarantool.org>

The patch adds a workflow that runs regression test suites, produces a
summary about current code coverage and send 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
---
 .github/actions/setup-linux/action.yml |  1 +
 .github/workflows/coverage.yml         | 60 ++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 .github/workflows/coverage.yml

diff --git a/.github/actions/setup-linux/action.yml b/.github/actions/setup-linux/action.yml
index f0171b83..71619a60 100644
--- a/.github/actions/setup-linux/action.yml
+++ b/.github/actions/setup-linux/action.yml
@@ -16,4 +16,5 @@ runs:
       run: |
         apt -y update
         apt -y install cmake gcc make ninja-build perl
+        pip3 install gcovr
       shell: bash
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644
index 00000000..9fff06c7
--- /dev/null
+++ b/.github/workflows/coverage.yml
@@ -0,0 +1,60 @@
+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 at v3
+        with:
+          fetch-depth: 0
+          submodules: recursive
+      - name: setup Linux
+        uses: ./.github/actions/setup-linux
+      - 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: test and generate code coverage report
+        run: cmake --build ${{ env.BUILDDIR }} --parallel --target 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 }}
-- 
2.34.1



More information about the Tarantool-patches mailing list