Skip to content

Commit bb9b61f

Browse files
committed
[CI] Move build options overrides to argument of the build_root.py.
Instead of using sed to replace lines in the build config files, pass option overrides directly to build_root.py. This leaves the build config files untouched, shows more clearly which builds run with overrides, prints these to the logs, and allows to remove an extra step from the CI.
1 parent ffc873d commit bb9b61f

File tree

1 file changed

+13
-52
lines changed

1 file changed

+13
-52
lines changed

.github/workflows/root-ci.yml

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -128,31 +128,6 @@ jobs:
128128
with:
129129
ref: ${{ inputs.ref_name }}
130130

131-
- name: Apply option overrides from matrix for this job for non-release builds
132-
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' && matrix.overrides != NaN }}
133-
env:
134-
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
135-
CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/${{ matrix.platform }}.txt'
136-
shell: bash
137-
run: |
138-
set -x
139-
140-
echo '' >> "$CONFIGFILE"
141-
142-
for ENTRY in $GLOBAL_OVERRIDES $OVERRIDES; do
143-
KEY=$( echo "$ENTRY" | cut -d '=' -f 1 )
144-
145-
# Add entry to file if not exists, otherwise replace
146-
147-
if grep -q "$KEY=" "$CONFIGFILE"; then
148-
sed -i "s/$KEY=.*\$/$ENTRY/" "$CONFIGFILE"
149-
else
150-
echo "$ENTRY" >> "$CONFIGFILE"
151-
fi
152-
done
153-
154-
cat "$CONFIGFILE" || true
155-
156131
- uses: root-project/gcc-problem-matcher-improved@main
157132
with:
158133
build-directory: /Users/sftnight/ROOT-CI/src/
@@ -167,6 +142,7 @@ jobs:
167142
HOME: /Users/sftnight
168143
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') && !matrix.platform == 'mac15' && !matrix.platform == 'mac26'}}
169144
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
145+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
170146
run: ".github/workflows/root-ci-config/build_root.py
171147
--buildtype RelWithDebInfo
172148
--incremental $INCREMENTAL
@@ -176,7 +152,8 @@ jobs:
176152
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
177153
--head_sha ${{ github.event.pull_request.head.sha }}
178154
--repository ${{ github.server_url }}/${{ github.repository }}
179-
--platform ${{ matrix.platform }}"
155+
--platform ${{ matrix.platform }}
156+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
180157

181158
- name: Workflow dispatch
182159
shell: bash -leo pipefail {0}
@@ -204,13 +181,17 @@ jobs:
204181
- name: Update build cache after push to release branch
205182
shell: bash -leo pipefail {0}
206183
if: github.event_name == 'push'
184+
env:
185+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
207186
run: ".github/workflows/root-ci-config/build_root.py
208187
--buildtype RelWithDebInfo
209188
--platform ${{ matrix.platform }}
210189
--incremental false
211190
--base_ref ${{ github.ref_name }}
212191
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
213-
--repository ${{ github.server_url }}/${{ github.repository }}"
192+
--repository ${{ github.server_url }}/${{ github.repository }}
193+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
194+
"
214195

215196
- name: Upload test results
216197
if: ${{ !cancelled() }}
@@ -491,31 +472,6 @@ jobs:
491472
ls -la
492473
'
493474

494-
- name: Apply option overrides from matrix for this job for all builds except non-special nightlies and releases
495-
if: ${{ ( github.event_name != 'schedule' || matrix.is_special) && github.event_name != 'workflow_dispatch' && matrix.overrides != NaN }}
496-
env:
497-
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
498-
CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/${{ matrix.image }}.txt'
499-
shell: bash
500-
run: |
501-
set -x
502-
503-
echo '' >> "$CONFIGFILE"
504-
505-
for ENTRY in $GLOBAL_OVERRIDES $OVERRIDES; do
506-
KEY=$( echo "$ENTRY" | cut -d '=' -f 1 )
507-
508-
# Add entry to file if not exists, otherwise replace
509-
510-
if grep -q "$KEY=" "$CONFIGFILE"; then
511-
sed -i "s/$KEY=.*\$/$ENTRY/" "$CONFIGFILE"
512-
else
513-
echo "$ENTRY" >> "$CONFIGFILE"
514-
fi
515-
done
516-
517-
cat "$CONFIGFILE" || true
518-
519475
- uses: root-project/gcc-problem-matcher-improved@main
520476
with:
521477
build-directory: /github/home/ROOT-CI/src/
@@ -526,6 +482,7 @@ jobs:
526482
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
527483
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
528484
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
485+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
529486
run: ".github/workflows/root-ci-config/build_root.py
530487
--buildtype RelWithDebInfo
531488
--platform ${{ matrix.image }}
@@ -537,6 +494,7 @@ jobs:
537494
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
538495
--head_sha ${{ github.event.pull_request.head.sha }}
539496
--repository ${{ github.server_url }}/${{ github.repository }}
497+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
540498
"
541499

542500
- name: Workflow dispatch
@@ -564,13 +522,16 @@ jobs:
564522

565523
- name: Update build cache after push to release branch
566524
if: github.event_name == 'push'
525+
env:
526+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
567527
run: ".github/workflows/root-ci-config/build_root.py
568528
--buildtype RelWithDebInfo
569529
--platform ${{ matrix.image }}
570530
--incremental false
571531
--base_ref ${{ github.ref_name }}
572532
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
573533
--repository ${{ github.server_url }}/${{ github.repository }}
534+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
574535
"
575536

576537
- name: Upload test results

0 commit comments

Comments
 (0)