Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .github/actions/build-debian-packages/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,29 @@ runs:
INPUTS_DEBIAN_VERSION: ${{ inputs.debian-version }}
- name: Build CF debian packages
run: |
sudo docker build --file "tools/buildutils/cw/Containerfile" --tag "android-cuttlefish-build" .
sudo docker run -v=$PWD:/mnt/build -w /mnt/build -v=$HOME/bazel-disk-cache:/root/bazel-disk-cache android-cuttlefish-build base -d /root/bazel-disk-cache &
Comment on lines +28 to +29
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The standard GitHub runners claim to have only 4 CPUs allocated. On top of that, bazel and go build which are used for cuttlefish-base and cuttlefish-frontend already have parallelism built in. I believe npm install is the only build system that will run serially, while the others will expand to fill all available CPUs, without coordinating to share the CPUs with other build systems.

By default docker run will use CPU share constraints for giving CPU time out to instances, but will still report the number of available CPUs that the host has unless controlled with a cpuset.

PID_BASE=$!
IMAGE_OPT=""
if [ -n "${INPUTS_IMAGE_VERSION}" ]; then
IMAGE_OPT="-e container_image_name=us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-orchestration:${INPUTS_IMAGE_VERSION}"
fi
sudo docker run ${IMAGE_OPT} -v=$PWD:/mnt/build -w /mnt/build android-cuttlefish-build container &
PID_CONTAINER=$!
sudo docker run -v=$PWD:/mnt/build -w /mnt/build android-cuttlefish-build frontend &
PID_FRONTEND=$!
sudo docker run -v=$PWD:/mnt/build -w /mnt/build android-cuttlefish-build cuttlefish-integration-gigabyte-arm64 &
PID_GIGABYTE=$!
# Wait for all background jobs and collect exit codes
exit_code=0
wait $PID_BASE || exit_code=$?
wait $PID_CONTAINER || exit_code=$?
wait $PID_FRONTEND || exit_code=$?
wait $PID_GIGABYTE || exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "One or more builds failed."
exit $exit_code
fi

sudo docker build --file "tools/buildutils/cw/Containerfile" --tag "android-cuttlefish-build" .
sudo docker run -v=$PWD:/mnt/build -w /mnt/build -v=$HOME/bazel-disk-cache:/root/bazel-disk-cache android-cuttlefish-build base -d /root/bazel-disk-cache
sudo docker run ${IMAGE_OPT} -v=$PWD:/mnt/build -w /mnt/build android-cuttlefish-build container
sudo docker run -v=$PWD:/mnt/build -w /mnt/build android-cuttlefish-build frontend
sudo docker run -v=$PWD:/mnt/build -w /mnt/build android-cuttlefish-build cuttlefish-integration-gigabyte-arm64
shell: bash
env:
INPUTS_IMAGE_VERSION: ${{ inputs.image-version }}
Loading