Skip to content

Commit 9cd1665

Browse files
committed
[CI] Add a workflow to update the homebrew macs.
1 parent b78500f commit 9cd1665

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: 'Update Homebrew Macs'
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'master'
8+
paths:
9+
- '.github/workflow/update-brew-macs.yml'
10+
11+
#TODO: Remove the below
12+
pull_request:
13+
branches:
14+
- 'master'
15+
16+
jobs:
17+
update-macos:
18+
if: github.repository_owner == 'root-project'
19+
20+
permissions:
21+
contents: read
22+
23+
# Use login shells to have brew and java available
24+
defaults:
25+
run:
26+
shell: bash -leo pipefail {0}
27+
28+
env:
29+
VENV_DIR: ${{ github.workspace }}/ROOT_CI_VENV
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- runner-label: experimental-brew-ci
36+
- runner-label: experimental-brew-ci-2
37+
38+
runs-on:
39+
- 'self-hosted'
40+
- ${{ matrix.runner-label }}
41+
42+
name: Update homebrew and Python
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
with:
48+
ref: ${{ inputs.ref_name }}
49+
path: src/
50+
51+
- name: Update brew packages
52+
run: |
53+
brew update
54+
brew install ccache googletest openjdk pyenv [email protected]
55+
echo "Installing official brew deps: $(brew deps --direct --include-build root)"
56+
brew install $(brew deps --direct --include-build root)
57+
58+
- name: Display software versions
59+
run: |
60+
java --version
61+
cmake --version
62+
which python3
63+
python3 --version
64+
65+
- name: Recreate Python venv
66+
run: |
67+
rm -rf ${VENV_DIR}
68+
$(brew --prefix [email protected])/bin/python3.12 -m venv ${VENV_DIR}
69+
source ${VENV_DIR}/bin/activate
70+
pip3 install --upgrade pip
71+
cat ${{ github.workspace }}/src/requirements.txt | while read PACKAGE; do
72+
if [ -n "${PACKAGE%%#*}" ]; then
73+
PACKAGE="${PACKAGE%%#*}"
74+
pip3 --no-cache-dir install -U "${PACKAGE}" || echo "::error file=update-brew-macs.yml::Could not install package ${PACKAGE}"
75+
fi
76+
done
77+

0 commit comments

Comments
 (0)