Skip to content

Commit cd3e3cd

Browse files
committed
[CI] Prepare Mac CI for homebrew-based VMs.
The homebrew VMs use a virtualenv for Python. Since it's not added to the path by default, we test if an environment has been set up and enter it before any build and test step. Furthermore, the paths to the ca certificates differ between the VMs and the physical Macs, so the setup of the environment variable will test multiple paths now.
1 parent 8ddebc9 commit cd3e3cd

File tree

1 file changed

+58
-40
lines changed

1 file changed

+58
-40
lines changed

.github/workflows/root-ci.yml

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ jobs:
101101
run:
102102
shell: bash -leo pipefail {0} # Use login shell, so profile scripts get sourced
103103

104+
env:
105+
VIRTUAL_ENV_DIR: ${{ github.workspace }}/ROOT_CI_VENV
106+
104107
strategy:
105108
fail-fast: false
106109
matrix:
@@ -117,15 +120,14 @@ jobs:
117120
overrides: ["CMAKE_CXX_STANDARD=23"]
118121
- platform: mac26
119122
arch: ARM64
123+
override_run_on: experimental-brew-ci-2
120124
- platform: mac-beta
121125
is_special: true
122126
arch: ARM64
123127

124-
runs-on: # Using '[self-hosted, ..., ...]' does not work for some reason :)
128+
runs-on:
125129
- self-hosted
126-
- macOS
127-
- ${{ matrix.arch }}
128-
- ${{ matrix.platform }}
130+
- ${{ matrix.override_run_on != '' && matrix.override_run_on || matrix.platform }}
129131

130132
name: |
131133
${{ matrix.platform }} ${{ matrix.arch }}
@@ -141,8 +143,13 @@ jobs:
141143
with:
142144
build-directory: /Users/sftnight/ROOT-CI/src/
143145

144-
- name: Set up curl CA bundle for Davix to work with https
145-
run: 'echo SSL_CERT_FILE=/opt/local/share/curl/curl-ca-bundle.crt >> $GITHUB_ENV'
146+
- name: Export SSL certificate files for Davix
147+
run: |
148+
for cert in /opt/homebrew/opt/ca-certificates/share/ca-certificates/cacert.pem /opt/local/share/curl/curl-ca-bundle.crt; do
149+
if [ -f ${cert} ]; then
150+
echo "SSL_CERT_FILE=${cert}" >> $GITHUB_ENV
151+
fi
152+
done
146153
147154
- name: Pull Request Build
148155
if: github.event_name == 'pull_request'
@@ -151,52 +158,63 @@ jobs:
151158
INCREMENTAL: ${{ !contains(github.event.pull_request.labels.*.name, 'clean build') && !matrix.platform == 'mac15' && !matrix.platform == 'mac26'}}
152159
GITHUB_PR_ORIGIN: ${{ github.event.pull_request.head.repo.clone_url }}
153160
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
154-
run: ".github/workflows/root-ci-config/build_root.py
155-
--buildtype RelWithDebInfo
156-
--incremental $INCREMENTAL
157-
--base_ref ${{ github.base_ref }}
158-
--sha ${{ github.sha }}
159-
--pull_repository ${{ github.event.pull_request.head.repo.clone_url }}
160-
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
161-
--head_sha ${{ github.event.pull_request.head.sha }}
162-
--repository ${{ github.server_url }}/${{ github.repository }}
163-
--platform ${{ matrix.platform }}
164-
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}"
161+
run: |
162+
[ -d "${VIRTUAL_ENV_DIR}" ] && source ${VIRTUAL_ENV_DIR}/bin/activate
163+
echo "Python is now $(which python3) $(python3 --version)"
164+
src/.github/workflows/root-ci-config/build_root.py \
165+
--buildtype RelWithDebInfo \
166+
--incremental $INCREMENTAL \
167+
--base_ref ${{ github.base_ref }} \
168+
--sha ${{ github.sha }} \
169+
--pull_repository ${{ github.event.pull_request.head.repo.clone_url }} \
170+
--head_ref refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }} \
171+
--head_sha ${{ github.event.pull_request.head.sha }} \
172+
--repository ${{ github.server_url }}/${{ github.repository }} \
173+
--platform ${{ matrix.platform }} \
174+
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
165175
166176
- name: Workflow dispatch
167177
if: ${{ github.event_name == 'workflow_dispatch' && !matrix.is_special }}
168-
run: ".github/workflows/root-ci-config/build_root.py
169-
--buildtype ${{ inputs.buildtype }}
170-
--platform ${{ matrix.platform }}
171-
--incremental ${{ inputs.incremental }}
172-
--base_ref ${{ inputs.base_ref }}
173-
--head_ref ${{ inputs.head_ref }}
174-
--binaries ${{ inputs.binaries }}
175-
--repository ${{ github.server_url }}/${{ github.repository }}"
178+
run: |
179+
[ -d "${VIRTUAL_ENV_DIR}" ] && source ${VIRTUAL_ENV_DIR}/bin/activate
180+
echo "Python is now $(which python3) $(python3 --version)"
181+
src/.github/workflows/root-ci-config/build_root.py \
182+
--buildtype ${{ inputs.buildtype }} \
183+
--platform ${{ matrix.platform }} \
184+
--incremental ${{ inputs.incremental }}\
185+
--base_ref ${{ inputs.base_ref }} \
186+
--head_ref ${{ inputs.head_ref }} \
187+
--binaries ${{ inputs.binaries }} \
188+
--repository ${{ github.server_url }}/${{ github.repository }}
176189
177190
- name: Nightly build
178191
if: github.event_name == 'schedule'
179-
run: ".github/workflows/root-ci-config/build_root.py
180-
--buildtype Release
181-
--platform ${{ matrix.platform }}
182-
--incremental false
183-
--binaries true
184-
--base_ref ${{ inputs.ref_name }}
185-
--repository ${{ github.server_url }}/${{ github.repository }}"
192+
run: |
193+
[ -d "${VIRTUAL_ENV_DIR}" ] && source ${VIRTUAL_ENV_DIR}/bin/activate
194+
echo "Python is now $(which python3) $(python3 --version)"
195+
src/.github/workflows/root-ci-config/build_root.py \
196+
--buildtype Release \
197+
--platform ${{ matrix.platform }} \
198+
--incremental false \
199+
--binaries true \
200+
--base_ref ${{ inputs.ref_name }} \
201+
--repository ${{ github.server_url }}/${{ github.repository }}
186202
187203
- name: Update build cache after push to release branch
188204
if: github.event_name == 'push'
189205
env:
190206
OVERRIDES: ${{ join( matrix.overrides, ' ') }}
191-
run: ".github/workflows/root-ci-config/build_root.py
192-
--buildtype RelWithDebInfo
193-
--platform ${{ matrix.platform }}
194-
--incremental false
195-
--base_ref ${{ github.ref_name }}
196-
--binaries ${{ startsWith(github.ref, 'refs/tags/') }}
197-
--repository ${{ github.server_url }}/${{ github.repository }}
207+
run: |
208+
[ -d "${VIRTUAL_ENV_DIR}" ] && source ${VIRTUAL_ENV_DIR}/bin/activate
209+
echo "Python is now $(which python3) $(python3 --version)"
210+
src/.github/workflows/root-ci-config/build_root.py \
211+
--buildtype RelWithDebInfo \
212+
--platform ${{ matrix.platform }} \
213+
--incremental false \
214+
--base_ref ${{ github.ref_name }} \
215+
--binaries ${{ startsWith(github.ref, 'refs/tags/') }} \
216+
--repository ${{ github.server_url }}/${{ github.repository }} \
198217
--overrides ${GLOBAL_OVERRIDES} ${OVERRIDES}
199-
"
200218
201219
- name: Upload test results
202220
if: ${{ !cancelled() }}

0 commit comments

Comments
 (0)