-
Notifications
You must be signed in to change notification settings - Fork 1.5k
205 lines (181 loc) · 6.56 KB
/
test-coverage.yml
File metadata and controls
205 lines (181 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: 'Test Coverage'
on:
schedule:
- cron: '0 1 * * *'
# https://github.com/root-project/root/pull/12112#issuecomment-1411004278
# DISABLED: takes 4 hours! Might clang-coverage be a solution?
pull_request:
branches:
- '**'
paths-ignore:
- 'doc/**'
- 'documentation/**'
workflow_call:
inputs:
head_ref:
type: string
required: true
default: master
base_ref:
type: string
required: true
default: master
ref_name:
type: string
default: master
# Enables manual start of workflow
workflow_dispatch:
inputs:
head_ref:
description: rebase from ...
type: string
required: true
default: master
base_ref:
description: ... to ... (can have same value)
type: string
required: true
default: master
incremental:
description: 'Do incremental build'
type: boolean
required: true
default: true
binaries:
description: Create binary packages and upload them as artifacts
type: boolean
required: true
default: false
buildtype:
description: The CMAKE_BUILD_TYPE to use
type: choice
options:
- Debug
- RelWithDebInfo
- Release
- MinSizeRel
default: Debug
required: true
env:
PYTHONUNBUFFERED: true
jobs:
build-linux:
if: |
( !(contains(github.event.pull_request.title, '[skip-ci]') || contains(github.event.pull_request.title, '[skip ci]')) )
&& ( ( github.repository_owner == 'root-project' && github.event_name != 'pull_request' )
|| ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'test coverage') ) )
permissions:
contents: read
runs-on:
- self-hosted
- linux
- x64
- cpu
name: Build and test to determine coverage
env:
PYTHONUNBUFFERED: true
OS_APPLICATION_CREDENTIAL_ID: '7f5b64a265244623a3a933308569bdba'
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
OS_AUTH_TYPE: 'v3applicationcredential'
OS_AUTH_URL: 'https://keystone.cern.ch/v3'
OS_IDENTITY_API_VERSION: 3
OS_INTERFACE: 'public'
OS_REGION_NAME: 'cern'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
container:
image: registry.cern.ch/root-ci/alma9:buildready
options: '--security-opt label=disable --rm'
steps:
- name: Set up Python Virtual Env
# if the `if` expr is false, `if` still has exit code 0.
# if the `if` block is entered, the block's exit code becomes the exit
# code of the `if`.
run: 'if [ -d /py-venv/ROOT-CI/bin/ ]; then . /py-venv/ROOT-CI/bin/activate && echo PATH=$PATH >> $GITHUB_ENV; fi'
# This should be part of the container image
- name: Install cov packages
run: |
dnf -y update
dnf -y install lcov
pip3 install gcovr
# This checks out the merge commit if this is a PR
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref_name }}
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
JOB_CONTEXT: ${{ toJSON(job) }}
ENV_CONTEXT: ${{ toJSON(env) }}
run: |
echo "$GITHUB_CONTEXT"
echo "--------------------------"
echo "$JOB_CONTEXT"
echo "--------------------------"
echo "$ENV_CONTEXT"
- name: Print debug info
run: 'printf "%s@%s\\n" "$(whoami)" "$(hostname)";
ls -la
'
- name: Apply option override from matrix for this job
env:
OVERRIDE: "coverage=ON"
FILE: .github/workflows/root-ci-config/buildconfig/alma9.txt
shell: bash
run: |
set -x
echo '' >> "$FILE"
echo $OVERRIDE >> "$FILE"
cat "$FILE" || true
- name: Pull Request Build
if: github.event_name == 'pull_request'
env:
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
run: ".github/workflows/root-ci-config/build_root.py
--buildtype Debug
--platform alma9
--incremental $INCREMENTAL
--coverage true
--base_ref ${{ github.base_ref }}
--sha ${{ github.sha }}
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
--head_sha ${{ github.event.pull_request.head.sha }}
--repository ${{ github.server_url }}/${{ github.repository }}
"
- name: Workflow dispatch
if: github.event_name == 'workflow_dispatch'
run: ".github/workflows/root-ci-config/build_root.py
--binaries ${{ inputs.binaries }}
--buildtype ${{ inputs.buildtype }}
--platform alma9
--incremental ${{ inputs.incremental }}
--coverage true
--base_ref ${{ inputs.base_ref }}
--sha ${{ github.sha }}
--head_ref ${{ inputs.head_ref }}
--head_sha ${{ inputs.head_ref }}
--repository ${{ github.server_url }}/${{ github.repository }}
"
- name: Nightly build
if: github.event_name == 'schedule'
run: ".github/workflows/root-ci-config/build_root.py
--buildtype Debug
--platform alma9
--incremental false
--coverage true
--base_ref ${{ github.ref_name }}
--sha ${{ github.sha }}
--repository ${{ github.server_url }}/${{ github.repository }}
"
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
env_vars: OS,PYTHON
fail_ci_if_error: true
files: /github/home/ROOT-CI/build/cobertura-cov.xml
flags: unittests
name: codecov-umbrella
verbose: true