Skip to content

Commit bcf6bab

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, the options can now be passed as arguments to build_root.py. This leaves the build config files untouched, and allows to remove an extra step from the CI.
1 parent 0e103b1 commit bcf6bab

File tree

1 file changed

+20
-54
lines changed

1 file changed

+20
-54
lines changed

.github/workflows/root-ci.yml

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -128,45 +128,21 @@ 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/
159134

160135
- name: Set up curl CA bundle for Davix to work with https
161136
run: 'echo SSL_CERT_FILE=/opt/local/share/curl/curl-ca-bundle.crt >> $GITHUB_ENV'
162-
137+
163138
- name: Pull Request Build
164139
shell: bash -leo pipefail {0}
165140
if: github.event_name == 'pull_request'
166141
env:
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}
@@ -193,24 +170,30 @@ jobs:
193170
- name: Nightly build
194171
shell: bash -leo pipefail {0}
195172
if: github.event_name == 'schedule'
173+
env:
174+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
196175
run: ".github/workflows/root-ci-config/build_root.py
197176
--buildtype Release
198177
--platform ${{ matrix.platform }}
199178
--incremental false
200179
--binaries true
201180
--base_ref ${{ inputs.ref_name }}
202-
--repository ${{ github.server_url }}/${{ github.repository }}"
181+
--repository ${{ github.server_url }}/${{ github.repository }}
182+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
203183

204184
- name: Update build cache after push to release branch
205185
shell: bash -leo pipefail {0}
206186
if: github.event_name == 'push'
187+
env:
188+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
207189
run: ".github/workflows/root-ci-config/build_root.py
208190
--buildtype RelWithDebInfo
209191
--platform ${{ matrix.platform }}
210192
--incremental false
211193
--base_ref ${{ github.ref_name }}
212194
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
213-
--repository ${{ github.server_url }}/${{ github.repository }}"
195+
--repository ${{ github.server_url }}/${{ github.repository }}
196+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
214197

215198
- name: Upload test results
216199
if: ${{ !cancelled() }}
@@ -491,31 +474,6 @@ jobs:
491474
ls -la
492475
'
493476

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-
519477
- uses: root-project/gcc-problem-matcher-improved@main
520478
with:
521479
build-directory: /github/home/ROOT-CI/src/
@@ -526,6 +484,7 @@ jobs:
526484
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
527485
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
528486
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
487+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
529488
run: ".github/workflows/root-ci-config/build_root.py
530489
--buildtype RelWithDebInfo
531490
--platform ${{ matrix.image }}
@@ -537,6 +496,7 @@ jobs:
537496
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
538497
--head_sha ${{ github.event.pull_request.head.sha }}
539498
--repository ${{ github.server_url }}/${{ github.repository }}
499+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
540500
"
541501

542502
- name: Workflow dispatch
@@ -553,24 +513,30 @@ jobs:
553513

554514
- name: Nightly build
555515
if: github.event_name == 'schedule'
516+
env:
517+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
556518
run: ".github/workflows/root-ci-config/build_root.py
557519
--buildtype Release
558520
--platform ${{ matrix.image }}
559521
--incremental false
560522
--binaries true
561523
--base_ref ${{ inputs.ref_name }}
562524
--repository ${{ github.server_url }}/${{ github.repository }}
525+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
563526
"
564527

565528
- name: Update build cache after push to release branch
566529
if: github.event_name == 'push'
530+
env:
531+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
567532
run: ".github/workflows/root-ci-config/build_root.py
568533
--buildtype RelWithDebInfo
569534
--platform ${{ matrix.image }}
570535
--incremental false
571536
--base_ref ${{ github.ref_name }}
572537
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
573538
--repository ${{ github.server_url }}/${{ github.repository }}
539+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
574540
"
575541

576542
- name: Upload test results

0 commit comments

Comments
 (0)