Skip to content

Commit 6664421

Browse files
tecandrewadeebshihadehBruce Wayne
authored
mac: fix setup and re-enable CI (commaai#23365)
* rework mac_setup.sh * ignore casadi and onnx runtime in pipfile for Darwin * remove rust stuff * build and install casadi * add wget * explicit python3. dont do onnx just yet * resource compiler * replace acados Darwin lib w universal2 libs * relock Pipfile using linux machine * Update update_requirements.sh brackets * Update update_requirements.sh oops * ci: re-enable mac build * attempt to fix ci build: * pip stuff? * move rcc bin path to env script * oops * only mac * k im lazy. does ci like this?? * huh?? * * use curl * avoid casadi rebuilds * add comment to remove protobuf * host detect typo * python version * how did the builds not use swig? * better reinstall check * sometimes mac clang complain abt error limit * ci: build OP in venv * ci: bump to Big Sur * retry? idk why it failed @ acados link * * use macos-latest * move rcc path to scons * add extra paths for odd homebrew installs * acados source change * update macOS README * uh, maybe? * k nvm * ci: ok this is strange. might be scons bug? * fix conflicts: bump * just add cppcheck for pre-commit stuff * agane * cleanup * try that * fix path * no pyenv update on mac * source * fix rpath prefix? * no examples * fix exit * let's get this cached * add virtualenvs to cache * why did we cache that * let's see what's big * more * always ruyn * cache scons cache * better cache key * fix for partial hit * why so long Co-authored-by: Andrew Tec <[email protected]> Co-authored-by: Adeeb Shihadeh <[email protected]> Co-authored-by: Bruce Wayne <[email protected]>
1 parent 207ce41 commit 6664421

File tree

12 files changed

+158
-92
lines changed

12 files changed

+158
-92
lines changed

.github/workflows/selfdrive_tests.yaml

Lines changed: 56 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -69,52 +69,62 @@ jobs:
6969
rm -rf /tmp/scons_cache/* && \
7070
scons -j$(nproc) --cache-populate"
7171
72-
#build_mac:
73-
# name: build macos
74-
# runs-on: macos-10.15
75-
# timeout-minutes: 60
76-
# steps:
77-
# - uses: actions/checkout@v2
78-
# with:
79-
# submodules: true
80-
# - name: Determine pre-existing Homebrew packages
81-
# if: steps.dependency-cache.outputs.cache-hit != 'true'
82-
# run: |
83-
# echo 'EXISTING_CELLAR<<EOF' >> $GITHUB_ENV
84-
# ls -1 /usr/local/Cellar >> $GITHUB_ENV
85-
# echo 'EOF' >> $GITHUB_ENV
86-
# - name: Cache dependencies
87-
# id: dependency-cache
88-
# uses: actions/cache@v2
89-
# with:
90-
# path: |
91-
# ~/.pyenv
92-
# ~/Library/Caches/pip
93-
# ~/Library/Caches/pipenv
94-
# /usr/local/Cellar
95-
# ~/github_brew_cache_entries.txt
96-
# key: macos-cache-${{ hashFiles('tools/mac_setup.sh') }}
97-
# - name: Brew link restored dependencies
98-
# if: steps.dependency-cache.outputs.cache-hit == 'true'
99-
# run: |
100-
# while read pkg; do
101-
# brew link --force "$pkg" # `--force` for keg-only packages
102-
# done < ~/github_brew_cache_entries.txt
103-
# - name: Install dependencies
104-
# run: ./tools/mac_setup.sh
105-
# - name: Build openpilot
106-
# run: eval "$(pyenv init -)" && scons -j$(nproc)
107-
# - name: Remove pre-existing Homebrew packages for caching
108-
# if: steps.dependency-cache.outputs.cache-hit != 'true'
109-
# run: |
110-
# cd /usr/local/Cellar
111-
# new_cellar=$(ls -1)
112-
# comm -12 <(echo "$EXISTING_CELLAR") <(echo "$new_cellar") | while read pkg; do
113-
# if [[ $pkg != "zstd" ]]; then # caching step needs zstd
114-
# rm -rf "$pkg"
115-
# fi
116-
# done
117-
# comm -13 <(echo "$EXISTING_CELLAR") <(echo "$new_cellar") | tee ~/github_brew_cache_entries.txt
72+
build_mac:
73+
name: build macos
74+
runs-on: macos-latest
75+
timeout-minutes: 60
76+
steps:
77+
- uses: actions/checkout@v2
78+
with:
79+
submodules: true
80+
- name: Determine pre-existing Homebrew packages
81+
if: steps.dependency-cache.outputs.cache-hit != 'true'
82+
run: |
83+
echo 'EXISTING_CELLAR<<EOF' >> $GITHUB_ENV
84+
ls -1 /usr/local/Cellar >> $GITHUB_ENV
85+
echo 'EOF' >> $GITHUB_ENV
86+
- name: Cache dependencies
87+
id: dependency-cache
88+
uses: actions/cache@v2
89+
with:
90+
path: |
91+
~/.pyenv
92+
~/.local/share/virtualenvs/
93+
/usr/local/Cellar
94+
~/github_brew_cache_entries.txt
95+
/tmp/scons_cache
96+
key: macos-${{ hashFiles('tools/mac_setup.sh', 'update_requirements.sh', 'Pipfile*') }}
97+
restore-keys: macos-
98+
- name: Brew link restored dependencies
99+
run: |
100+
if [ -f ~/github_brew_cache_entries.txt ]; then
101+
while read pkg; do
102+
brew link --force "$pkg" # `--force` for keg-only packages
103+
done < ~/github_brew_cache_entries.txt
104+
else
105+
echo "Cache entries not found"
106+
fi
107+
- name: Install dependencies
108+
run: ./tools/mac_setup.sh
109+
- name: Build openpilot
110+
run: |
111+
source tools/openpilot_env.sh
112+
pipenv run selfdrive/manager/build.py
113+
114+
# cleanup scons cache
115+
rm -rf /tmp/scons_cache/
116+
pipenv run scons -j$(nproc) --cache-populate
117+
- name: Remove pre-existing Homebrew packages for caching
118+
if: steps.dependency-cache.outputs.cache-hit != 'true'
119+
run: |
120+
cd /usr/local/Cellar
121+
new_cellar=$(ls -1)
122+
comm -12 <(echo "$EXISTING_CELLAR") <(echo "$new_cellar") | while read pkg; do
123+
if [[ $pkg != "zstd" ]]; then # caching step needs zstd
124+
rm -rf "$pkg"
125+
fi
126+
done
127+
comm -13 <(echo "$EXISTING_CELLAR") <(echo "$new_cellar") | tee ~/github_brew_cache_entries.txt
118128
119129
build_webcam:
120130
name: build webcam

Pipfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tenacity = "*"
3838

3939
[packages]
4040
atomicwrites = "*"
41-
casadi = "*"
41+
casadi = {version = "*", markers="platform_system != 'Darwin'"}
4242
cffi = "*"
4343
crcmod = "*"
4444
cryptography = "*"
@@ -54,7 +54,7 @@ libusb1 = "*"
5454
nose = "*"
5555
numpy = "*"
5656
onnx = "*"
57-
onnxruntime-gpu = "*"
57+
onnxruntime-gpu = {version = "*", markers="platform_system != 'Darwin'"}
5858
pillow = "*"
5959
psutil = "*"
6060
pycapnp = "==1.1.0"

Pipfile.lock

Lines changed: 39 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SConstruct

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ lenv = {
6666
"LD_LIBRARY_PATH": [Dir(f"#third_party/acados/{arch}/lib").abspath],
6767
"PYTHONPATH": Dir("#").abspath + ":" + Dir("#pyextra/").abspath,
6868

69-
"ACADOS_SOURCE_DIR": Dir("#third_party/acados/acados").abspath,
69+
"ACADOS_SOURCE_DIR": Dir("#third_party/acados/include/acados").abspath,
7070
"ACADOS_PYTHON_INTERFACE_PATH": Dir("#pyextra/acados_template").abspath,
7171
"TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer",
7272
}
@@ -125,15 +125,18 @@ else:
125125
f"#third_party/libyuv/{yuv_dir}/lib",
126126
"/usr/local/lib",
127127
"/opt/homebrew/lib",
128+
"/usr/local/Homebrew/Library",
128129
"/usr/local/opt/openssl/lib",
129130
"/opt/homebrew/opt/openssl/lib",
131+
"/usr/local/Cellar",
130132
f"#third_party/acados/{arch}/lib",
131133
"/System/Library/Frameworks/OpenGL.framework/Libraries",
132134
]
133135
cflags += ["-DGL_SILENCE_DEPRECATION"]
134136
cxxflags += ["-DGL_SILENCE_DEPRECATION"]
135137
cpppath += [
136138
"/opt/homebrew/include",
139+
"/usr/local/include",
137140
"/usr/local/opt/openssl/include",
138141
"/opt/homebrew/opt/openssl/include"
139142
]
@@ -235,6 +238,9 @@ env = Environment(
235238
tools=["default", "cython", "compilation_db"],
236239
)
237240

241+
if arch == "Darwin":
242+
env['RPATHPREFIX'] = "-rpath "
243+
238244
if GetOption('compile_db'):
239245
env.CompilationDatabase('compile_commands.json')
240246

@@ -299,6 +305,7 @@ if arch == "Darwin":
299305
qt_dirs += [f"{qt_env['QTDIR']}/include/Qt{m}" for m in qt_modules]
300306
qt_env["LINKFLAGS"] += ["-F" + os.path.join(qt_env['QTDIR'], "lib")]
301307
qt_env["FRAMEWORKS"] += [f"Qt{m}" for m in qt_modules] + ["OpenGL"]
308+
qt_env.AppendENVPath('PATH', os.path.join(qt_env['QTDIR'], "bin"))
302309
elif arch == "aarch64":
303310
qt_env['QTDIR'] = "/system/comma/usr"
304311
qt_dirs = [
448 KB
Binary file not shown.
1.61 MB
Binary file not shown.
1.17 MB
Binary file not shown.
288 KB
Binary file not shown.

0 commit comments

Comments
 (0)