From f45369f81014cf5f7be0e22e9924eb964da74127 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Wed, 16 Oct 2024 12:43:49 +0200 Subject: [PATCH] Allow selection of CPU architecture for build --- .github/workflows/build.yaml | 9 +++++++-- .github/workflows/interactive.yaml | 9 +++++++++ src/env.sh | 13 ++++++++++++- src/scripts/prepare.sh | 2 ++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e41b01a7..3f37a2e1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,8 +11,13 @@ on: required: false # defaults to 'one' DEB_DISTRO: type: string - description: The Debian/Ubuntu distribution codename to compile for. + description: The Debian/Ubuntu distribution codename to compile for required: false # defaults to 'lsb_release -cs' + ARCH: + type: string + required: false + description: CPU architecture + default: x64 ROS_SOURCES: type: string description: ROS sources to compile. See README.md for details. @@ -118,7 +123,7 @@ env: jobs: debs: - runs-on: ubuntu-22.04 + runs-on: ${{ inputs.ARCH == 'x64' && 'ubuntu-22.04' || inputs.ARCH }} name: build debs outputs: LATEST_PACKAGE: ${{ steps.build.outputs.LATEST_PACKAGE }} diff --git a/.github/workflows/interactive.yaml b/.github/workflows/interactive.yaml index 8aa0d5fd..b803e788 100644 --- a/.github/workflows/interactive.yaml +++ b/.github/workflows/interactive.yaml @@ -19,6 +19,14 @@ on: required: true description: 'ROS distribution codename:' default: one + ARCH: + type: choice + required: true + description: 'Architecture:' + default: x64 + options: + - x64 + - arm64 # source selection ROS_SOURCES: @@ -60,6 +68,7 @@ jobs: with: DEB_DISTRO: ${{ inputs.DEB_DISTRO || vars.DEB_DISTRO }} ROS_DISTRO: ${{ inputs.ROS_DISTRO || vars.ROS_DISTRO || 'one' }} + ARCH: ${{ inputs.ARCH || vars.ARCH || 'x64' }} ROS_SOURCES: ${{ inputs.ROS_SOURCES || vars.ROS_SOURCES }} INSTALL_GPG_KEYS: | sudo curl -sSL https://ros.packages.techfak.net/gpg.key -o /etc/apt/keyrings/ros-one-keyring.gpg diff --git a/src/env.sh b/src/env.sh index 0d9c2925..4512816d 100644 --- a/src/env.sh +++ b/src/env.sh @@ -79,7 +79,18 @@ if debian-distro-info --all | grep -q "$DEB_DISTRO"; then elif ubuntu-distro-info --all | grep -q "$DEB_DISTRO"; then export DISTRIBUTION=ubuntu - export DISTRIBUTION_REPO=http://azure.archive.ubuntu.com/ubuntu + case "$(dpkg --print-architecture)" in + amd64) + export DISTRIBUTION_REPO=http://archive.ubuntu.com/ubuntu + ;; + arm64,armhf) + export DISTRIBUTION_REPO=http://ports.ubuntu.com/ubuntu-ports + ;; + *) + gha_error "Unknown architecture: $ARCH" + ici_exit 1 + ;; + esac else gha_error "Unknown DEB_DISTRO: $DEB_DISTRO" ici_exit 1 diff --git a/src/scripts/prepare.sh b/src/scripts/prepare.sh index 99971719..1151654d 100755 --- a/src/scripts/prepare.sh +++ b/src/scripts/prepare.sh @@ -44,6 +44,8 @@ ici_timed "Install bloom" ici_asroot pip install -U git+https://github.com/rhasc # Install patched vcstool to allow for treeless clones ici_timed "Install vcstool" ici_asroot pip install -U git+https://github.com/rhaschke/vcstool.git@master +# remove existing rosdep config to avoid conflicts with rosdep init +ici_asroot rm -f /etc/ros/rosdep/sources.list.d/20-default.list ici_timed "rosdep init" ici_asroot rosdep init # Start apt-cacher-ng if not yet running (for example in docker)