mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-07 17:27:01 +08:00
Setup cleanup vol. 2 (#29456)
* code from setup cleanup #29419
update ci
update ci
export variables for mac os
check env
what is in the profile script?
install pyenv the same everywhere
temporarily disable brew cache
temporarily disable brew cache
try fixing pyenv virtualenv-init
try this
inject shims path earlier
try alternate install method
switch back to brew install
try eval "$(pyenv init --path)"
add eval "\$(pyenv init --path)"
* Add local .env file to the cache list
* Change .env paths
* debug line
* order?
* remove .env
* Add .venv to caches
---------
Co-authored-by: Greg Hogan <gregjhogan@gmail.com>
old-commit-hash: 0f7be5b1e6
This commit is contained in:
@@ -117,6 +117,8 @@ jobs:
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
.env
|
||||
.venv
|
||||
~/github_brew_cache_entries.txt
|
||||
~/.pyenv
|
||||
~/Library/Caches/pypoetry
|
||||
@@ -148,18 +150,17 @@ jobs:
|
||||
PYTHONWARNINGS: default
|
||||
- name: Build openpilot
|
||||
run: |
|
||||
source tools/openpilot_env.sh
|
||||
eval "$(pyenv init --path)"
|
||||
poetry run scons -j$(nproc)
|
||||
- name: Run tests
|
||||
run: |
|
||||
source tools/openpilot_env.sh
|
||||
export PYTHONPATH=$PWD
|
||||
eval "$(pyenv init --path)"
|
||||
poetry run tools/plotjuggler/test_plotjuggler.py
|
||||
- name: Pre Cache - Cleanup scons cache
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
source tools/openpilot_env.sh
|
||||
rm -rf /tmp/scons_cache/*
|
||||
eval "$(pyenv init --path)"
|
||||
poetry run scons -j$(nproc) --cache-populate
|
||||
- name: Save scons cache
|
||||
id: scons-save-cache
|
||||
|
||||
@@ -14,21 +14,19 @@ if ! command -v "pyenv" > /dev/null 2>&1; then
|
||||
echo "pyenv install ..."
|
||||
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
|
||||
|
||||
echo -e "\n. ~/.pyenvrc" >> $RC_FILE
|
||||
cat <<EOF > "${HOME}/.pyenvrc"
|
||||
if [ -z "\$PYENV_ROOT" ]; then
|
||||
export PATH=\$HOME/.pyenv/bin:\$HOME/.pyenv/shims:\$PATH
|
||||
export PYENV_ROOT="\$HOME/.pyenv"
|
||||
eval "\$(pyenv init --path)"
|
||||
eval "\$(pyenv init -)"
|
||||
eval "\$(pyenv virtualenv-init -)"
|
||||
fi
|
||||
EOF
|
||||
echo -e "\nsource ~/.pyenvrc" >> $RC_FILE
|
||||
|
||||
# setup now without restarting shell
|
||||
export PATH=$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
eval "$(pyenv init -)"
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
# activate pyenv now
|
||||
source $RC_FILE
|
||||
fi
|
||||
|
||||
export MAKEFLAGS="-j$(nproc)"
|
||||
@@ -53,6 +51,12 @@ poetry config virtualenvs.prefer-active-python true --local
|
||||
poetry config virtualenvs.in-project true --local
|
||||
|
||||
echo "PYTHONPATH=${PWD}" > $ROOT/.env
|
||||
if [[ "$(uname)" == 'Darwin' ]]; then
|
||||
echo "# msgq doesn't work on mac" >> $ROOT/.env
|
||||
echo "export ZMQ=1" >> $ROOT/.env
|
||||
echo "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" >> $ROOT/.env
|
||||
fi
|
||||
|
||||
poetry self add poetry-dotenv-plugin@^0.1.0
|
||||
|
||||
echo "pip packages install..."
|
||||
|
||||
+1
-8
@@ -46,6 +46,7 @@ brew "libtool"
|
||||
brew "llvm"
|
||||
brew "openssl@3.0"
|
||||
brew "pyenv"
|
||||
brew "pyenv-virtualenv"
|
||||
brew "qt@5"
|
||||
brew "zeromq"
|
||||
brew "gcc@12"
|
||||
@@ -69,16 +70,8 @@ export CPPFLAGS="$CPPFLAGS -I${BREW_PREFIX}/opt/openssl@3/include"
|
||||
export PYCURL_CURL_CONFIG=/usr/bin/curl-config
|
||||
export PYCURL_SSL_LIBRARY=openssl
|
||||
|
||||
# openpilot environment
|
||||
if [ -z "$OPENPILOT_ENV" ] && [ -n "$RC_FILE" ] && [ -z "$CI" ]; then
|
||||
echo "source $ROOT/tools/openpilot_env.sh" >> $RC_FILE
|
||||
source "$ROOT/tools/openpilot_env.sh"
|
||||
echo "Added openpilot_env to RC file: $RC_FILE"
|
||||
fi
|
||||
|
||||
# install python dependencies
|
||||
$DIR/install_python_dependencies.sh
|
||||
eval "$(pyenv init --path)"
|
||||
echo "[ ] installed python dependencies t=$SECONDS"
|
||||
|
||||
echo
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
if [ -z "$OPENPILOT_ENV" ]; then
|
||||
export PATH="$HOME/.pyenv/bin:$PATH"
|
||||
|
||||
# Pyenv suggests we place the below two lines in .profile before we source
|
||||
# .bashrc, but there is no simple way to guarantee we do this correctly
|
||||
# programmatically across heterogeneous systems. For end-user convenience,
|
||||
# we add the lines here as a workaround.
|
||||
# https://github.com/pyenv/pyenv/issues/1906
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
|
||||
if [[ "$(uname)" == 'Linux' ]]; then
|
||||
eval "$(pyenv virtualenv-init -)"
|
||||
elif [[ "$(uname)" == 'Darwin' ]]; then
|
||||
# msgq doesn't work on mac
|
||||
export ZMQ=1
|
||||
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
|
||||
fi
|
||||
eval "$(pyenv init --path)"
|
||||
eval "$(pyenv init -)"
|
||||
|
||||
export OPENPILOT_ENV=1
|
||||
fi
|
||||
@@ -141,13 +141,6 @@ fi
|
||||
# python setup
|
||||
$DIR/install_python_dependencies.sh
|
||||
|
||||
source ~/.bashrc
|
||||
if [ -z "$OPENPILOT_ENV" ]; then
|
||||
printf "\nsource %s/tools/openpilot_env.sh" "$ROOT" >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
echo "added openpilot_env to bashrc"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "---- OPENPILOT SETUP DONE ----"
|
||||
echo "Open a new shell or configure your active shell env by running:"
|
||||
|
||||
Reference in New Issue
Block a user