Compare commits

..

5 Commits

Author SHA1 Message Date
royjr 6252bc37b2 Update opendbc_repo 2026-08-18 01:01:24 -04:00
royjr d1f3acf9d4 Merge branch 'master' into hens 2026-08-17 17:13:35 -04:00
royjr 6eb64fe64f Update opendbc_repo 2026-08-17 17:09:57 -04:00
royjr e0e2db4179 Update opendbc_repo 2026-08-17 09:41:13 -04:00
royjr 8d5f74b84a Update opendbc_repo 2026-08-16 15:30:31 -04:00
3 changed files with 90 additions and 42 deletions
@@ -4,8 +4,12 @@ env:
BUILD_DIR: "/data/openpilot" BUILD_DIR: "/data/openpilot"
OUTPUT_DIR: ${{ github.workspace }}/output OUTPUT_DIR: ${{ github.workspace }}/output
CI_DIR: ${{ github.workspace }}/release/ci CI_DIR: ${{ github.workspace }}/release/ci
SCONS_CACHE_DIR: ${{ github.workspace }}/release/ci/scons_cache
PUBLIC_REPO_URL: "https://github.com/sunnypilot/sunnypilot" PUBLIC_REPO_URL: "https://github.com/sunnypilot/sunnypilot"
# Branch configurations
STAGING_SOURCE_BRANCH: 'master'
# Runtime configuration # Runtime configuration
SOURCE_BRANCH: "${{ github.head_ref || github.ref_name }}" SOURCE_BRANCH: "${{ github.head_ref || github.ref_name }}"
@@ -105,6 +109,11 @@ jobs:
group: build-${{ github.head_ref || github.ref_name }} group: build-${{ github.head_ref || github.ref_name }}
cancel-in-progress: false cancel-in-progress: false
runs-on: [self-hosted, tici] runs-on: [self-hosted, tici]
outputs:
new_branch: ${{ needs.prepare_strategy.outputs.new_branch }}
version: ${{ needs.prepare_strategy.outputs.version }}
extra_version_identifier: ${{ needs.prepare_strategy.outputs.extra_version_identifier }}
commit_sha: ${{ github.sha }}
if: ${{ if: ${{
(always() && !cancelled() && !failure()) && (always() && !cancelled() && !failure()) &&
needs.prepare_strategy.result == 'success' && needs.prepare_strategy.result == 'success' &&
@@ -120,8 +129,26 @@ jobs:
repository: ${{ github.event.pull_request.head.repo.fork && github.event.pull_request.head.repo.full_name || github.repository }} repository: ${{ github.event.pull_request.head.repo.fork && github.event.pull_request.head.repo.full_name || github.repository }}
- run: git lfs pull - run: git lfs pull
- name: Cache SCons
uses: actions/cache@v4
with:
path: ${{env.SCONS_CACHE_DIR}}
key: scons-${{ runner.os }}-${{ runner.arch }}-${{ env.SOURCE_BRANCH }}-${{ github.sha }}
# Note: GitHub Actions enforces cache isolation between different build sources (PR builds, workflow dispatches, etc.)
# for security. Only caches from the default branch are shared across all builds. This is by design and cannot be overridden.
restore-keys: |
scons-${{ runner.os }}-${{ runner.arch }}-${{ env.SOURCE_BRANCH }}
scons-${{ runner.os }}-${{ runner.arch }}-${{ env.STAGING_SOURCE_BRANCH }}
scons-${{ runner.os }}-${{ runner.arch }}
- name: Set environment variables - name: Set environment variables
id: set-env
run: | run: |
echo "new_branch=${{ needs.prepare_strategy.outputs.new_branch }}" >> $GITHUB_OUTPUT
echo "version=${{ needs.prepare_strategy.outputs.version }}" >> $GITHUB_OUTPUT
echo "extra_version_identifier=${{ needs.prepare_strategy.outputs.extra_version_identifier }}" >> $GITHUB_OUTPUT
echo "commit_sha=${{ github.sha }}" >> $GITHUB_OUTPUT
# Set up common environment # Set up common environment
source /etc/profile; source /etc/profile;
export UV_PROJECT_ENVIRONMENT=${HOME}/venv export UV_PROJECT_ENVIRONMENT=${HOME}/venv
@@ -130,6 +157,9 @@ jobs:
export VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT export VIRTUAL_ENV=$UV_PROJECT_ENVIRONMENT
uv sync uv sync
printenv >> $GITHUB_ENV printenv >> $GITHUB_ENV
if [[ "${{ runner.debug }}" == "1" ]]; then
cat $GITHUB_OUTPUT
fi
- name: Setup build environment - name: Setup build environment
run: | run: |
@@ -138,7 +168,7 @@ jobs:
echo "Starting build stage..." echo "Starting build stage..."
echo "BUILD_DIR: ${BUILD_DIR}" echo "BUILD_DIR: ${BUILD_DIR}"
echo "CI_DIR: ${CI_DIR}" echo "CI_DIR: ${CI_DIR}"
echo "VERSION: ${{ needs.prepare_strategy.outputs.version }}" echo "VERSION: ${{ steps.set-env.outputs.version }}"
echo "UV_PROJECT_ENVIRONMENT: ${UV_PROJECT_ENVIRONMENT}" echo "UV_PROJECT_ENVIRONMENT: ${UV_PROJECT_ENVIRONMENT}"
echo "VIRTUAL_ENV: ${VIRTUAL_ENV}" echo "VIRTUAL_ENV: ${VIRTUAL_ENV}"
echo "-------" echo "-------"
@@ -150,44 +180,61 @@ jobs:
- name: Build Main Project - name: Build Main Project
run: | run: |
export PYTHONPATH="$BUILD_DIR:$BUILD_DIR/msgq_repo:$BUILD_DIR/opendbc_repo:$BUILD_DIR/rednose_repo:$BUILD_DIR/teleoprtc_repo:$BUILD_DIR/tinygrad_repo" export PYTHONPATH="$BUILD_DIR"
./tools/release/release_files.py | xargs -0 cp -pR --parents -t "$BUILD_DIR" -- ./tools/release/release_files.py | sort | uniq | rsync -rRl${RUNNER_DEBUG:+v} --files-from=- . $BUILD_DIR/
# outside the checkout, which is wiped each run. /data/scons_cache is the device's, not ours.
SCONS_CACHE="$RUNNER_WORKSPACE/scons_cache"
mkdir -p "$SCONS_CACHE"
cd $BUILD_DIR cd $BUILD_DIR
echo "Building locationd..." ln -sfn msgq_repo/msgq msgq
# -j1: parallel rednose generators OOM the device ln -sfn opendbc_repo/opendbc opendbc
scons -j1 cache_dir="$SCONS_CACHE" --minimal \ ln -sfn rednose_repo/rednose rednose
openpilot/selfdrive/locationd openpilot/sunnypilot/selfdrive/locationd ln -sfn teleoprtc_repo/teleoprtc teleoprtc
ln -sfn tinygrad_repo/tinygrad tinygrad
sed -i '/from .board.jungle import PandaJungle, PandaJungleDFU/s/^/#/' panda/__init__.py
echo "Building sunnypilot's modeld_v2..."
scons -j$(nproc) cache_dir=${{env.SCONS_CACHE_DIR}} --minimal openpilot/sunnypilot/modeld_v2
echo "Building sunnypilot's locationd..."
scons -j2 cache_dir=${{env.SCONS_CACHE_DIR}} --minimal openpilot/sunnypilot/selfdrive/locationd
echo "Building openpilot's locationd..."
scons -j1 cache_dir=${{env.SCONS_CACHE_DIR}} --minimal openpilot/selfdrive/locationd
echo "Building rest of sunnypilot" echo "Building rest of sunnypilot"
/usr/bin/time -v scons -j$(nproc) cache_dir="$SCONS_CACHE" --minimal scons -j$(nproc) cache_dir=${{env.SCONS_CACHE_DIR}} --minimal
touch ${BUILD_DIR}/prebuilt touch ${BUILD_DIR}/prebuilt
if [[ "${{ runner.debug }}" == "1" ]]; then if [[ "${{ runner.debug }}" == "1" ]]; then
ls -la ${BUILD_DIR} ls -la ${BUILD_DIR}
fi fi
- name: Strip release tree - name: Prepare Output
run: | run: |
cd $BUILD_DIR sudo rm -rf ${OUTPUT_DIR}
find . -name '*.a' -delete mkdir -p ${OUTPUT_DIR}
find . -name '*.o' -delete rsync -am${RUNNER_DEBUG:+v} \
find . -name '*.os' -delete --exclude='.sconsign.dblite' \
find . -name '*.pyc' -delete --exclude='*.a' \
find . -name 'moc_*' -delete --exclude='*.o' \
find . -name '__pycache__' -type d -exec rm -rf {} + --exclude='*.os' \
find . -name 'SConstruct' -delete --exclude='*.pyc' \
find . -name 'SConscript' -delete --exclude='moc_*' \
rm -rf .sconsign.dblite Jenkinsfile tools/release/ release/ --exclude='__pycache__' \
rm -f openpilot/selfdrive/modeld/models/*.onnx* --exclude='Jenkinsfile' \
rm -f openpilot/sunnypilot/modeld*/models/*.onnx* --exclude='**/release/' \
find openpilot/third_party/ -name '*x86*' -exec rm -r {} + --exclude='**/.github/' \
find openpilot/third_party/ -name '*Darwin*' -exec rm -r {} + --exclude='**/openpilot/selfdrive/ui/replay/' \
cd - --exclude='**/__pycache__/' \
--exclude='${{env.SCONS_CACHE_DIR}}' \
--exclude='**/.git/' \
--exclude='**/SConstruct' \
--exclude='**/SConscript' \
--exclude='**/.venv/' \
--exclude='openpilot/selfdrive/modeld/models/*.onnx*' \
--exclude='openpilot/sunnypilot/modeld*/models/*.onnx*' \
--exclude='openpilot/third_party/*x86*' \
--exclude='openpilot/third_party/*Darwin*' \
--delete-excluded \
--chown=comma:comma \
${BUILD_DIR}/ ${OUTPUT_DIR}/
- name: 'Tar.gz files' - name: 'Tar.gz files'
run: | run: |
tar czf prebuilt.tar.gz -C ${{ env.BUILD_DIR }} . tar czf prebuilt.tar.gz -C ${{ env.OUTPUT_DIR }} .
ls -la prebuilt.tar.gz ls -la prebuilt.tar.gz
- name: 'Upload Artifact' - name: 'Upload Artifact'
@@ -195,7 +242,6 @@ jobs:
with: with:
name: prebuilt name: prebuilt
path: prebuilt.tar.gz path: prebuilt.tar.gz
compression-level: 0
- name: Re-enable powersave - name: Re-enable powersave
if: always() if: always()
@@ -237,22 +283,29 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
echo '${{ toJSON(needs.prepare_strategy.outputs) }}' echo '${{ toJSON(needs.build.outputs) }}'
ls -la ${{ env.OUTPUT_DIR }} ls -la ${{ env.OUTPUT_DIR }}
${{ env.CI_DIR }}/publish.sh \ ${{ env.CI_DIR }}/publish.sh \
"${{ github.workspace }}" \ "${{ github.workspace }}" \
"${{ env.OUTPUT_DIR }}" \ "${{ env.OUTPUT_DIR }}" \
"${{ needs.prepare_strategy.outputs.new_branch }}" \ "${{ needs.build.outputs.new_branch }}" \
"${{ needs.prepare_strategy.outputs.version }}" \ "${{ needs.build.outputs.version }}" \
"https://x-access-token:${{github.token}}@github.com/sunnypilot/sunnypilot.git" \ "https://x-access-token:${{github.token}}@github.com/sunnypilot/sunnypilot.git" \
"${{ needs.prepare_strategy.outputs.extra_version_identifier }}" "${{ needs.build.outputs.extra_version_identifier }}"
echo ""
echo "---- ️ To update the list of branches that auto deploy prebuilts -----"
echo ""
echo "1. Go to: ${{ github.server_url }}/${{ github.repository }}/settings/variables/actions/AUTO_DEPLOY_PREBUILT_BRANCHES"
echo "2. Current value: ${{ vars.AUTO_DEPLOY_PREBUILT_BRANCHES }}"
echo "3. Update as needed (JSON array with no spaces)"
- name: Tag ${{ needs.prepare_strategy.outputs.environment }} - name: Tag ${{ needs.prepare_strategy.outputs.environment }}
if: ${{ needs.prepare_strategy.outputs.is_stable_branch == 'true' && (github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')) }} if: ${{ needs.prepare_strategy.outputs.is_stable_branch == 'true' && (github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')) }}
run: | run: |
TAG="${{ needs.prepare_strategy.outputs.environment }}/${{ needs.prepare_strategy.outputs.version }}/${{ needs.prepare_strategy.outputs.build }}" TAG="${{ needs.prepare_strategy.outputs.environment }}/${{ needs.prepare_strategy.outputs.version }}/${{ needs.prepare_strategy.outputs.build }}"
git tag -f -a ${TAG} -m "${{ needs.prepare_strategy.outputs.environment }} @ ${{ needs.prepare_strategy.outputs.version }} of build ${{ needs.prepare_strategy.outputs.build }}." git tag -f -a ${TAG} -m "${{ needs.prepare_strategy.outputs.environment }} @ ${{ needs.prepare_strategy.outputs.version }} of build ${{ needs.build.outputs.build }}."
git push -f origin ${TAG} git push -f origin ${TAG}
notify: notify:
@@ -271,6 +324,7 @@ jobs:
- name: Prepare notification message - name: Prepare notification message
id: message id: message
run: | run: |
TEMPLATE='${{ vars.DISCOURSE_GENERAL_UPDATE_NOTICE }}'
export VERSION="${{ needs.prepare_strategy.outputs.version }}" export VERSION="${{ needs.prepare_strategy.outputs.version }}"
export branch_name="${{ env.SOURCE_BRANCH }}" export branch_name="${{ env.SOURCE_BRANCH }}"
export new_branch="${{ needs.prepare_strategy.outputs.new_branch }}" export new_branch="${{ needs.prepare_strategy.outputs.new_branch }}"
@@ -319,7 +373,7 @@ jobs:
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
issue_number: prNumber, issue_number: prNumber,
name: process.env.LABEL name: process.env.LABELf
}); });
console.log(`Removed '${process.env.LABEL}' label from PR #${prNumber}`); console.log(`Removed '${process.env.LABEL}' label from PR #${prNumber}`);
-6
View File
@@ -52,12 +52,6 @@ git fetch origin $DEV_BRANCH || (git checkout -b $DEV_BRANCH && git commit --all
echo "[-] committing version $VERSION T=$SECONDS" echo "[-] committing version $VERSION T=$SECONDS"
git add -f . git add -f .
# gitlinks break the release tree on device
if git ls-files -s | awk '$1 == "160000" { found = 1; print } END { exit !found }'; then
echo "Error: submodules found in release tree."
exit 1
fi
# include source commit hash and build date in commit # include source commit hash and build date in commit
GIT_HASH=$(git --git-dir=$SOURCE_DIR/.git rev-parse HEAD) GIT_HASH=$(git --git-dir=$SOURCE_DIR/.git rev-parse HEAD)
DATETIME=$(date '+%Y-%m-%dT%H:%M:%S') DATETIME=$(date '+%Y-%m-%dT%H:%M:%S')