Files
sunnypilot/release/build_release.sh
Jason Wen 59a16b9cdc Merge branch 'upstream/openpilot/master' into sync-20260225
# Conflicts:
#	.github/workflows/auto_pr_review.yaml
#	.github/workflows/badges.yaml
#	.github/workflows/mici_raylib_ui_preview.yaml
#	.github/workflows/prebuilt.yaml
#	.github/workflows/raylib_ui_preview.yaml
#	.github/workflows/release.yaml
#	.github/workflows/repo-maintenance.yaml
#	.github/workflows/tests.yaml
#	.gitignore
#	Dockerfile.openpilot_base
#	SConstruct
#	docs/CARS.md
#	opendbc_repo
#	panda
#	release/build_release.sh
#	selfdrive/modeld/SConscript
#	selfdrive/modeld/modeld.py
#	selfdrive/pandad/panda_safety.cc
#	selfdrive/pandad/pandad.cc
#	selfdrive/pandad/pandad.py
#	selfdrive/test/process_replay/process_replay.py
#	selfdrive/ui/layouts/onboarding.py
#	selfdrive/ui/mici/layouts/home.py
#	selfdrive/ui/tests/diff/replay.py
#	selfdrive/ui/tests/test_ui/raylib_screenshots.py
#	tools/mac_setup.sh
#	uv.lock
2026-02-27 16:12:57 -05:00

103 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
set -x
# git diff --name-status origin/release3-staging | grep "^A" | less
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR
BUILD_DIR=/data/openpilot
SOURCE_DIR="$(git rev-parse --show-toplevel)"
if [ -z "$RELEASE_BRANCH" ]; then
echo "RELEASE_BRANCH is not set"
exit 1
fi
# set git identity
source $DIR/identity.sh
echo "[-] Setting up repo T=$SECONDS"
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR
cd $BUILD_DIR
git init
git remote add origin git@github.com:commaai/openpilot.git
git checkout --orphan $RELEASE_BRANCH
# do the files copy
echo "[-] copying files T=$SECONDS"
cd $SOURCE_DIR
cp -pR --parents $(./release/release_files.py) $BUILD_DIR/
# in the directory
cd $BUILD_DIR
rm -f panda/board/obj/panda.bin.signed
rm -f panda/board/obj/panda_h7.bin.signed
VERSION=$(cat sunnypilot/common/version.h | awk -F[\"-] '{print $2}')
echo "[-] committing version $VERSION T=$SECONDS"
git add -f .
git commit -a -m "openpilot v$VERSION release"
# Build
export PYTHONPATH="$BUILD_DIR"
scons -j$(nproc) --minimal
if [ -z "$PANDA_DEBUG_BUILD" ]; then
# release panda fw
CERT=/data/pandaextra/certs/release RELEASE=1 scons -j$(nproc) panda/
else
# build with ALLOW_DEBUG=1 to enable features like experimental longitudinal
scons -j$(nproc) panda/
fi
# Ensure no submodules in release
if test "$(git submodule--helper list | wc -l)" -gt "0"; then
echo "submodules found:"
git submodule--helper list
exit 1
fi
git submodule status
# Cleanup
find . -name '*.a' -delete
find . -name '*.o' -delete
find . -name '*.os' -delete
find . -name '*.pyc' -delete
find . -name 'moc_*' -delete
find . -name '__pycache__' -delete
rm -rf .sconsign.dblite Jenkinsfile release/
rm -f selfdrive/modeld/models/*.onnx
rm -f sunnypilot/modeld*/models/*.onnx
find third_party/ -name '*x86*' -exec rm -r {} +
find third_party/ -name '*Darwin*' -exec rm -r {} +
# Restore third_party
git checkout third_party/
# Mark as prebuilt release
touch prebuilt
# Add built files to git
git add -f .
git commit --amend -m "openpilot v$VERSION"
# Run tests
cd $BUILD_DIR
RELEASE=1 pytest -n0 -s selfdrive/test/test_onroad.py
#pytest selfdrive/car/tests/test_car_interfaces.py
if [ ! -z "$RELEASE_BRANCH" ]; then
echo "[-] pushing release T=$SECONDS"
git push -f origin $RELEASE_BRANCH:$RELEASE_BRANCH
fi
echo "[-] done T=$SECONDS"