Skip to content
Snippets Groups Projects
Unverified Commit 63e0c036 authored by Yaroslav Lobankov's avatar Yaroslav Lobankov
Browse files

ci: split debug_coverage.yml into two workflows

This change splits the debug_coverage.yml workflow into two independent
workflows: debug.yml and coverage.yml.

The first one will be run on push to a branch and creating/updating
external pool requests. In other words, it will be run always.

The second one will be run on push to a branch only if the branch has
the `full-ci` suffix (some-branch-full-ci) or the `full-ci` label is set
on a pool request, internal or external - it doesn't matter.

Why do we need it?

1. The coverage testing is heavy testing due to enabling long tests
   and takes at least 2 times more time than debug build testing. So
   testing that is done at the first stage (lint, release, debug) will
   pass faster.
2. The coverage report as a pool request comment from coveralls.io can
   be obtained only if a pool request event happened. It is a limitation
   of the `coverallsapp/github-action` action [1]. So there is no sense
   to run the coverage workflow on push events. But the coverage report
   on push still can be seen on coveralls.io if the branch has the
   `full-ci` suffix.
3. The logic of the debug_coverage.yml workflow is tricky enough and no
   one understands how it works. So we would like to have an absolutely
   transparent and simple workflow.

[1] https://github.com/coverallsapp/github-action/tree/8cbef1dea373ebce56de0a14c68d6267baa10b44#coveralls-github-action

Closes tarantool/tarantool-qa#147

NO_DOC=ci
NO_CHANGELOG=ci

(cherry picked from commit 5fdc1ea2)
parent 87188193
No related branches found
No related tags found
No related merge requests found
name: coverage
on:
push:
branches:
- 'master'
- '[0-9].[0-9]+'
- '**-full-ci'
tags:
- '**'
pull_request:
types: [ opened, reopened, synchronize, labeled ]
workflow_dispatch:
concurrency:
# Update of a developer branch cancels the previously scheduled workflow
# run for this branch. However, the 'master' branch, release branch (1.10,
# 2.8, etc.), and tag 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.
#
# Important: 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: ${{ (
github.ref == 'refs/heads/master' ||
github.ref == 'refs/heads/1.10' ||
startsWith(github.ref, 'refs/heads/2.') ||
startsWith(github.ref, 'refs/tags/')) &&
format('{0}-{1}', github.run_id, github.run_attempt) ||
format('{0}-{1}', github.workflow, github.ref) }}
cancel-in-progress: true
jobs:
coverage:
# Run on pull request only if the 'full-ci' label is set.
if: github.event_name != 'pull_request' ||
contains(github.event.pull_request.labels.*.name, 'full-ci')
runs-on: ubuntu-20.04-self-hosted
steps:
- name: Sources checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
submodules: recursive
- name: Set environment
uses: ./.github/actions/environment
- name: Run testing with coverage enabled
run: make -f .travis.mk coverage_ubuntu_ghactions
- name: Upload coverage results to coveralls.io
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.info
- name: Send Telegram message on failure
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_CORE_TOKEN }}
TELEGRAM_TO: ${{ secrets.TELEGRAM_CORE_TO }}
uses: ./.github/actions/send-telegram-notify
if: failure()
- name: Collect artifacts
uses: actions/upload-artifact@v2
with:
name: failure-logs
retention-days: 21
path: ./coverage.info
name: debug_coverage
name: debug
on:
push:
......@@ -7,8 +7,6 @@ on:
tags:
- '**'
pull_request:
repository_dispatch:
types: [backend_automation]
workflow_dispatch:
concurrency:
......@@ -31,75 +29,40 @@ concurrency:
format('{0}-{1}', github.workflow, github.ref) }}
cancel-in-progress: true
env:
CI_MAKE: make -f .travis.mk
jobs:
debug_coverage:
debug:
# Run on pull request only if the 'notest' label is unset and this is
# an external PR (internal PRs trigger a run on push).
if: github.event_name != 'pull_request' ||
( ! contains(github.event.pull_request.labels.*.name, 'notest') &&
github.event.pull_request.head.repo.full_name != github.repository )
( !contains(github.event.pull_request.labels.*.name, 'notest') &&
github.event.pull_request.head.repo.full_name != github.repository )
runs-on: ubuntu-20.04-self-hosted
steps:
# Finds an associated PR (PR can be detected only on push and never on pull_request).
# WARNING !!! use in these ways only:
# on push: steps.findPr.outputs.pr
# on pull_request: github.event.pull_request.number
- name: Find the PR associated with this push on push trigger, if there is one.
uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Runs w/o PR on push otherwise on PR events.
# To avoid of issue https://github.com/coverallsapp/github-action/issues/55
# sources checkout should be based on 2nd action version and later.
- name: Sources checkout
if: ( steps.findPr.outputs.pr == false && github.event_name == 'push' ) ||
github.event_name == 'pull_request'
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
submodules: recursive
# Runs w/o PR on push otherwise on PR events.
- name: Set environment
if: ( steps.findPr.outputs.pr == false && github.event_name == 'push' ) ||
github.event_name == 'pull_request'
uses: ./.github/actions/environment
# Runs w/o PR on push otherwise on PR events.
- name: test
if: ( steps.findPr.outputs.pr == false && github.event_name == 'push' ) ||
github.event_name == 'pull_request'
run: ${CI_MAKE} coverage_ubuntu_ghactions
# Runs w/o PR on push otherwise on PR events.
- name: Upload coverage.info results to coveralls.io
if: success() &&
( ( steps.findPr.outputs.pr == false && github.event_name == 'push' ) ||
github.event_name == 'pull_request' )
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.info
# Runs on failure only.
- name: call action to send Telegram message on failure
- name: Run testing
run: make -f .travis.mk debug_ubuntu_ghactions
- name: Send Telegram message on failure
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_CORE_TOKEN }}
TELEGRAM_TO: ${{ secrets.TELEGRAM_CORE_TO }}
uses: ./.github/actions/send-telegram-notify
if: failure()
# Runs w/o PR on push otherwise on PR events
# for failed tests either Coveralls results.
- name: artifacts
- name: Collect artifacts
uses: actions/upload-artifact@v2
if: always() &&
( ( steps.findPr.outputs.pr == false && github.event_name == 'push' ) ||
github.event_name == 'pull_request' )
if: failure()
with:
name: debug
name: failure-logs
retention-days: 21
path: |
${{ env.VARDIR }}/artifacts
*.info
path: ${{ env.VARDIR }}/artifacts
......@@ -161,7 +161,19 @@ test_ubuntu_ghactions: deps_ubuntu_ghactions test_debian_no_deps
test_debian_clang11: deps_debian deps_buster_clang_11 test_debian_no_deps
# Debug with coverage
# Debug
build_debug_debian:
cmake . -DCMAKE_BUILD_TYPE=Debug
make -j
test_debug_debian_no_deps: build_debug_debian
make LuaJIT-test
cd test && ./test-run.py --vardir ${VARDIR} --force $(TEST_RUN_EXTRA_PARAMS)
debug_ubuntu_ghactions: deps_ubuntu_ghactions test_debug_debian_no_deps
# Coverage
build_coverage_debian:
cmake . -DCMAKE_BUILD_TYPE=Debug -DENABLE_GCOV=ON
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment