Skip to content

Commit 2a9e470

Browse files
committed
[CI][WIP] Move build options overrides to argument of the build_root.py.
Instead of using sed to replace lines in a text files, the options can now be passed as arguments build_root.py.
1 parent 517b5bc commit 2a9e470

File tree

1 file changed

+23
-41
lines changed

1 file changed

+23
-41
lines changed

.github/workflows/root-ci.yml

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -128,45 +128,29 @@ jobs:
128128
with:
129129
ref: ${{ inputs.ref_name }}
130130

131-
- name: Apply option overrides from matrix for this job for non-release builds
131+
- name: Print desired overrides
132132
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' && matrix.overrides != NaN }}
133133
env:
134134
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
135135
CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/${{ matrix.platform }}.txt'
136136
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
137+
run: echo "Remember to set the following overrides GLOBAL=$GLOBAL_OVERRIDES LOCAL=$OVERRIDES"
155138

156139
- uses: root-project/gcc-problem-matcher-improved@main
157140
with:
158141
build-directory: /Users/sftnight/ROOT-CI/src/
159142

160143
- name: Set up curl CA bundle for Davix to work with https
161144
run: 'echo SSL_CERT_FILE=/opt/local/share/curl/curl-ca-bundle.crt >> $GITHUB_ENV'
162-
145+
163146
- name: Pull Request Build
164147
shell: bash -leo pipefail {0}
165148
if: github.event_name == 'pull_request'
166149
env:
167150
HOME: /Users/sftnight
168151
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') && !matrix.platform == 'mac15' && !matrix.platform == 'mac26'}}
169152
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
153+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
170154
run: ".github/workflows/root-ci-config/build_root.py
171155
--buildtype RelWithDebInfo
172156
--incremental $INCREMENTAL
@@ -176,7 +160,8 @@ jobs:
176160
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
177161
--head_sha ${{ github.event.pull_request.head.sha }}
178162
--repository ${{ github.server_url }}/${{ github.repository }}
179-
--platform ${{ matrix.platform }}"
163+
--platform ${{ matrix.platform }}
164+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
180165

181166
- name: Workflow dispatch
182167
shell: bash -leo pipefail {0}
@@ -193,24 +178,30 @@ jobs:
193178
- name: Nightly build
194179
shell: bash -leo pipefail {0}
195180
if: github.event_name == 'schedule'
181+
env:
182+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
196183
run: ".github/workflows/root-ci-config/build_root.py
197184
--buildtype Release
198185
--platform ${{ matrix.platform }}
199186
--incremental false
200187
--binaries true
201188
--base_ref ${{ inputs.ref_name }}
202-
--repository ${{ github.server_url }}/${{ github.repository }}"
189+
--repository ${{ github.server_url }}/${{ github.repository }}
190+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
203191

204192
- name: Update build cache after push to release branch
205193
shell: bash -leo pipefail {0}
206194
if: github.event_name == 'push'
195+
env:
196+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
207197
run: ".github/workflows/root-ci-config/build_root.py
208198
--buildtype RelWithDebInfo
209199
--platform ${{ matrix.platform }}
210200
--incremental false
211201
--base_ref ${{ github.ref_name }}
212202
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
213-
--repository ${{ github.server_url }}/${{ github.repository }}"
203+
--repository ${{ github.server_url }}/${{ github.repository }}
204+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
214205

215206
- name: Upload test results
216207
if: ${{ !cancelled() }}
@@ -497,24 +488,7 @@ jobs:
497488
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
498489
CONFIGFILE: '.github/workflows/root-ci-config/buildconfig/${{ matrix.image }}.txt'
499490
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
491+
run: echo "Remember to set these overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
518492

519493
- uses: root-project/gcc-problem-matcher-improved@main
520494
with:
@@ -526,6 +500,7 @@ jobs:
526500
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') }}
527501
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
528502
CMAKE_GENERATOR: ${{ matrix.cmake_generator }}
503+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
529504
run: ".github/workflows/root-ci-config/build_root.py
530505
--buildtype RelWithDebInfo
531506
--platform ${{ matrix.image }}
@@ -537,6 +512,7 @@ jobs:
537512
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
538513
--head_sha ${{ github.event.pull_request.head.sha }}
539514
--repository ${{ github.server_url }}/${{ github.repository }}
515+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
540516
"
541517

542518
- name: Workflow dispatch
@@ -553,24 +529,30 @@ jobs:
553529

554530
- name: Nightly build
555531
if: github.event_name == 'schedule'
532+
env:
533+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
556534
run: ".github/workflows/root-ci-config/build_root.py
557535
--buildtype Release
558536
--platform ${{ matrix.image }}
559537
--incremental false
560538
--binaries true
561539
--base_ref ${{ inputs.ref_name }}
562540
--repository ${{ github.server_url }}/${{ github.repository }}
541+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
563542
"
564543

565544
- name: Update build cache after push to release branch
566545
if: github.event_name == 'push'
546+
env:
547+
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
567548
run: ".github/workflows/root-ci-config/build_root.py
568549
--buildtype RelWithDebInfo
569550
--platform ${{ matrix.image }}
570551
--incremental false
571552
--base_ref ${{ github.ref_name }}
572553
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
573554
--repository ${{ github.server_url }}/${{ github.repository }}
555+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
574556
"
575557

576558
- name: Upload test results

0 commit comments

Comments
 (0)