Skip to content

Commit fc663bc

Browse files
committed
[CI] Move build options overrides to argument of 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 e2b3d98 commit fc663bc

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
@@ -133,31 +133,6 @@ jobs:
133133
with:
134134
ref: ${{ inputs.ref_name }}
135135

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

186163
- name: Workflow dispatch
187164
shell: bash -leo pipefail {0}
@@ -209,13 +186,17 @@ jobs:
209186
- name: Update build cache after push to release branch
210187
shell: bash -leo pipefail {0}
211188
if: github.event_name == 'push'
189+
env:
190+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
212191
run: ".github/workflows/root-ci-config/build_root.py
213192
--buildtype RelWithDebInfo
214193
--platform ${{ matrix.platform }}
215194
--incremental false
216195
--base_ref ${{ github.ref_name }}
217196
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
218-
--repository ${{ github.server_url }}/${{ github.repository }}"
197+
--repository ${{ github.server_url }}/${{ github.repository }}
198+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
199+
"
219200

220201
- name: Upload test results
221202
if: ${{ !cancelled() }}
@@ -496,31 +477,6 @@ jobs:
496477
ls -la
497478
'
498479

499-
- name: Apply option overrides from matrix for this job for all builds except non-special nightlies and releases
500-
if: ${{ ( github.event_name != 'schedule' || matrix.is_special) && github.event_name != 'workflow_dispatch' && matrix.overrides != NaN }}
501-
env:
502-
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
503-
CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/${{ matrix.image }}.txt'
504-
shell: bash
505-
run: |
506-
set -x
507-
508-
echo '' >> "$CONFIGFILE"
509-
510-
for ENTRY in $GLOBAL_OVERRIDES $OVERRIDES; do
511-
KEY=$( echo "$ENTRY" | cut -d '=' -f 1 )
512-
513-
# Add entry to file if not exists, otherwise replace
514-
515-
if grep -q "$KEY=" "$CONFIGFILE"; then
516-
sed -i "s/$KEY=.*\$/$ENTRY/" "$CONFIGFILE"
517-
else
518-
echo "$ENTRY" >> "$CONFIGFILE"
519-
fi
520-
done
521-
522-
cat "$CONFIGFILE" || true
523-
524480
- uses: root-project/gcc-problem-matcher-improved@main
525481
with:
526482
build-directory: /github/home/ROOT-CI/src/
@@ -531,6 +487,7 @@ jobs:
531487
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
532488
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
533489
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
490+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
534491
run: ".github/workflows/root-ci-config/build_root.py
535492
--buildtype RelWithDebInfo
536493
--platform ${{ matrix.image }}
@@ -542,6 +499,7 @@ jobs:
542499
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
543500
--head_sha ${{ github.event.pull_request.head.sha }}
544501
--repository ${{ github.server_url }}/${{ github.repository }}
502+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
545503
"
546504

547505
- name: Workflow dispatch
@@ -569,13 +527,16 @@ jobs:
569527

570528
- name: Update build cache after push to release branch
571529
if: github.event_name == 'push'
530+
env:
531+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
572532
run: ".github/workflows/root-ci-config/build_root.py
573533
--buildtype RelWithDebInfo
574534
--platform ${{ matrix.image }}
575535
--incremental false
576536
--base_ref ${{ github.ref_name }}
577537
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
578538
--repository ${{ github.server_url }}/${{ github.repository }}
539+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
579540
"
580541

581542
- name: Upload test results

0 commit comments

Comments
 (0)