Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewchambers committed Oct 19, 2024
1 parent debd71e commit ea09f16
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 15 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ runs:
run: |
find . -type f -executable -not -perm 755 -exec chmod 755 {} \;
find . -type f -not -executable -not -perm 644 -exec chmod 644 {} \;
- id: debug
shell: bash
run: ls
- id: build-chroot
shell: bash
run: sudo ./tools/build_ci_chroot.sh
# build our docker image
- shell: bash
run: eval ${{ env.BUILD }}
#- shell: bash
# run: eval ${{ env.BUILD }}
16 changes: 3 additions & 13 deletions .github/workflows/tools_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
name: tools

on:
push:
branches:
- master
pull_request:
workflow_call:
inputs:
run_number:
default: '1'
required: true
type: string
on: workflow_dispatch
concurrency:
group: tools-tests-ci-run-${{ inputs.run_number }}-${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.run_id || github.head_ref || github.ref }}-${{ github.workflow }}-${{ github.event_name }}
group: wip
cancel-in-progress: true

env:
Expand All @@ -21,7 +11,7 @@ env:

BUILD: selfdrive/test/docker_build.sh base

RUN: docker run --shm-size 2G -v $GITHUB_WORKSPACE:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c
RUN: echo TODO && false


jobs:
Expand Down
106 changes: 106 additions & 0 deletions tools/build_ci_chroot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/env bash
set -eux

apt-get update
apt-get install -y debootstrap tar zstd

mkdir /tmp/chroot

debootstrap --variant=minbase noble /tmp/chroot http://archive.ubuntu.com/ubuntu

mkdir -p /tmp/chroot/tmp/tools
cp tools/install_ubuntu_dependencies.sh /tmp/chroot/tmp/tools
cp tools/install_python_dependencies.sh /tmp/chroot/tmp/tools
cp pyproject.toml uv.lock /tmp/chroot/tmp

cat <<EOF > /tmp/chroot/etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu noble main
deb http://archive.ubuntu.com/ubuntu noble universe
deb http://archive.ubuntu.com/ubuntu noble multiverse
deb http://archive.ubuntu.com/ubuntu noble restricted
EOF

cat <<EOF > /tmp/chroot/tmp/install-deps.sh
set -eux
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates \
sudo \
tzdata \
locales \
ssh \
pulseaudio \
xvfb \
x11-xserver-utils \
gnome-screenshot \
apt-utils \
alien \
unzip \
tar \
curl \
xz-utils \
dbus \
gcc-arm-none-eabi \
tmux \
vim \
libx11-6 \
wget
mkdir -p /tmp/opencl-driver-intel
cd /tmp/opencl-driver-intel
wget https://github.com/intel/llvm/releases/download/2024-WW14/oclcpuexp-2024.17.3.0.09_rel.tar.gz
wget https://github.com/oneapi-src/oneTBB/releases/download/v2021.12.0/oneapi-tbb-2021.12.0-lin.tgz
mkdir -p /opt/intel/oclcpuexp_2024.17.3.0.09_rel
cd /opt/intel/oclcpuexp_2024.17.3.0.09_rel
tar -zxvf /tmp/opencl-driver-intel/oclcpuexp-2024.17.3.0.09_rel.tar.gz
mkdir -p /etc/OpenCL/vendors
echo /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64/libintelocl.so > /etc/OpenCL/vendors/intel_expcpu.icd
cd /opt/intel
tar -zxvf /tmp/opencl-driver-intel/oneapi-tbb-2021.12.0-lin.tgz
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbb.so /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbbmalloc.so /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbb.so.12 /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64
ln -s /opt/intel/oneapi-tbb-2021.12.0/lib/intel64/gcc4.8/libtbbmalloc.so.2 /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64
mkdir -p /etc/ld.so.conf.d
echo /opt/intel/oclcpuexp_2024.17.3.0.09_rel/x64 > /etc/ld.so.conf.d/libintelopenclexp.conf
ldconfig -f /etc/ld.so.conf.d/libintelopenclexp.conf
cd /
rm -rf /tmp/opencl-driver-intel
echo "NVIDIA_VISIBLE_DEVICES=all" >> /etc/environment
echo "NVIDIA_DRIVER_CAPABILITIES=graphics,utility,compute" >> /etc/environment
echo "QTWEBENGINE_DISABLE_SANDBOX=1" >> /etc/environment
USER=batman
USER_UID=1001
useradd -m -s /bin/bash -u \$USER_UID \$USER
usermod -aG sudo $USER
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
chown \$USER /tmp/{pyproject.toml,uv.lock,tools/install_python_dependencies.sh}
dbus-uuidgen > /etc/machine-id
# Remove arm architecture toolchains that we don't want.
cd /usr/lib/gcc/arm-none-eabi/*
rm -rf arm/ thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp
# Remove all the tmp files.
rm -rf /tmp/* /tmp/.*
# Clean up the apt cache, there are lots of archives.
apt clean
EOF

cp /etc/resolv.conf /tmp/chroot/resolv.conf
mount --bind /proc /tmp/chroot/proc
mount --bind /sys /tmp/chroot/sys
mount --bind /dev /tmp/chroot/dev
chmod +x /tmp/chroot/tmp/install-deps.sh
chroot /tmp/chroot bash /tmp/install-deps.sh
umount /tmp/chroot/proc
umount /tmp/chroot/sys
umount /tmp/chroot/dev

tar -C /tmp/chroot -cp - | zstd -9 > /tmp/chroot.tar.zstd
du -h /tmp/chroot.tar.zstd

0 comments on commit ea09f16

Please sign in to comment.