Skip to content

Commit

Permalink
Merge pull request #1173 from tier4/feature/arm_support
Browse files Browse the repository at this point in the history
Feature/arm_build_test
  • Loading branch information
hakuturu583 authored Apr 2, 2024
2 parents 253fa78 + c8a9504 commit f8b6369
Show file tree
Hide file tree
Showing 18 changed files with 557 additions and 40 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/BuildAndRun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ on:
- master
jobs:
job1:
name: Build and run
runs-on: ubuntu-22.04
name: BuildAndRun
runs-on: ${{ matrix.runs_on }}
timeout-minutes: 180
container: ros:${{ matrix.rosdistro }}
env:
Expand All @@ -29,6 +29,7 @@ jobs:
fail-fast: false
matrix:
rosdistro: [humble]
runs_on: [ubuntu-22.04] # macos-14 is added for arm support. See also https://x.com/github/status/1752458943245189120?s=20
steps:
- name: Suppress warnings
run: git config --global --add safe.directory '*'
Expand Down
52 changes: 33 additions & 19 deletions .github/workflows/Docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,39 @@ on:
- cron: 0 0 * * *
pull_request:
paths:
- '**'
- '!docs/**'
- '!README.md'
- '!.github/**'
- '.github/workflows/Docker.yaml'
- '!mkdocs.yml'
- "**"
- "!docs/**"
- "!README.md"
- "!.github/**"
- ".github/workflows/Docker.yaml"
- "!mkdocs.yml"
push:
branches:
- master
release:
types: [published]
jobs:
job1:
name: Build Docker image
runs-on: ubuntu-20.04
timeout-minutes: 180
build_docker_image:
name: Build Docker Image
runs-on: ubuntu-22.04
timeout-minutes: 720
strategy:
matrix:
rosdistro: [humble]
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false

- name: Install docker for ubuntu runner
uses: docker/setup-buildx-action@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Install QEMU
uses: docker/setup-qemu-action@v3

- uses: actions/checkout@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand All @@ -38,10 +47,15 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
- name: Build and push (${{ matrix.arch }})
uses: docker/bake-action@v3
with:
tags: ghcr.io/${{ github.repository_owner }}/scenario_simulator_v2:${{ matrix.rosdistro }}
no-cache: true
build-args: ROS_DISTRO=${{ matrix.rosdistro }}
push: ${{ github.event_name != 'pull_request' }}
files: |
./docker-bake.hcl
workdir: .
set: |
*.cache-to=type=gha,mode=max
*.cache-from=type=gha
push: ${{ github.event_name != 'pull_request' && matrix.arch == 'amd64' }}
targets: |
${{ matrix.rosdistro }}_base_${{ matrix.arch }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ log
# external packages
external/*
!external/concealer
!external/embree_vendor

# auto-generated files
html
Expand Down
38 changes: 30 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
ARG ROS_DISTRO
FROM ros:${ROS_DISTRO}
ARG ROS_DISTRO="humble"
FROM ros:${ROS_DISTRO} as build-stage
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NOWARNINGS=yes
ARG ROS_DISTRO

RUN sudo apt-get update && sudo apt-get -y install python3-pip python3-rospkg python3-rosdep software-properties-common
RUN --mount=type=cache,id=apt-cache-amd64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-amd64,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get -y install python3-pip python3-rospkg python3-rosdep software-properties-common ccache
# cspell: ignore kisak
RUN add-apt-repository ppa:kisak/kisak-mesa -y
RUN apt-get update && apt-get install libegl-mesa0 -y
RUN --mount=type=cache,id=apt-cache-amd64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-amd64,target=/var/lib/apt,sharing=locked \
add-apt-repository ppa:kisak/kisak-mesa -y
RUN --mount=type=cache,id=apt-cache-amd64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-amd64,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install libegl-mesa0 -y

RUN rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator
COPY . $WORKDIR
Expand All @@ -18,10 +26,24 @@ RUN mkdir -p /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator/e
WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator
RUN vcs import external < dependency_${ROS_DISTRO}.repos
WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && rosdep install -iy --from-paths . --rosdistro ${ROS_DISTRO}
RUN --mount=type=cache,id=apt-cache-amd64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-amd64,target=/var/lib/apt,sharing=locked \
source /opt/ros/${ROS_DISTRO}/setup.bash \
&& apt-get update \
&& rosdep install -iy --from-paths . --rosdistro ${ROS_DISTRO}

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

ENV CC="/usr/lib/ccache/gcc"
ENV CXX="/usr/lib/ccache/g++"
ENV CCACHE_DIR="/ccache"
RUN --mount=type=cache,target=/ccache source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_CPP_MOCK_SCENARIOS=ON
COPY ./docker-entrypoint.sh /
RUN chmod a+x /docker-entrypoint.sh

Expand Down
53 changes: 53 additions & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
ARG ROS_DISTRO="humble"

# cspell: ignore impactaky deno BUILDPLATFORM TARGETARCH

FROM --platform=${BUILDPLATFORM} impactaky/mc-ubuntu22.04-${TARGETARCH}-host:2.1.0 AS mimic-host
FROM ros:${ROS_DISTRO} as build-stage

SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
ENV DEBCONF_NOWARNINGS=yes

COPY --from=mimic-host / /mimic-cross
RUN /mimic-cross/mimic-cross.deno/setup.sh

RUN --mount=type=cache,id=apt-cache-arm64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-arm64,target=/var/lib/apt,sharing=locked \
sudo apt-get update && sudo apt-get -y install python3-pip python3-rospkg python3-rosdep software-properties-common ccache
# cspell: ignore kisak
RUN --mount=type=cache,id=apt-cache-arm64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-arm64,target=/var/lib/apt,sharing=locked \
add-apt-repository ppa:kisak/kisak-mesa -y
RUN --mount=type=cache,id=apt-cache-arm64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-arm64,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install libegl-mesa0 -y

RUN rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator
COPY . $WORKDIR

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/
RUN mkdir -p /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator/external
WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src/scenario_simulator
RUN vcs import external < dependency_${ROS_DISTRO}.repos
WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws/src
RUN --mount=type=cache,id=apt-cache-arm64,target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-arm64,target=/var/lib/apt,sharing=locked \
source /opt/ros/${ROS_DISTRO}/setup.bash \
&& apt-get update \
&& rosdep install -iy --from-paths . --rosdistro ${ROS_DISTRO}

WORKDIR /home/ubuntu/Desktop/scenario_simulator_ws

RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_CPP_MOCK_SCENARIOS=ON
COPY ./docker-entrypoint.sh /
RUN chmod a+x /docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
26 changes: 26 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
group "default" {
targets = ["humble"]
}

target "base_amd64" {
target = "build-stage"
dockerfile = "Dockerfile"
platforms = ["linux/amd64"]
}

target "base_arm64" {
target = "build-stage"
dockerfile = "Dockerfile.arm64"
platforms = ["linux/arm64/v8"]
}

target "humble" {
inherits = [base]
name = "humble_${base}"
tags = ["ghcr.io/tier4/scenario_simulator_v2:humble"]
args = {"ROS_DISTRO" : "humble"}
group = ["humble"]
matrix = {
base = ["base_amd64", "base_arm64"]
}
}
2 changes: 2 additions & 0 deletions external/embree_vendor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
debian
obj-x86_64-linux-gnu
79 changes: 79 additions & 0 deletions external/embree_vendor/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package embree_vendor
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.0.9 (2021-07-13)
------------------

0.1.0 (2021-07-14)
------------------
* Merge branch 'master' of https://github.com/OUXT-Polaris/embree_vendor
* Merge pull request `#4 <https://github.com/OUXT-Polaris/embree_vendor/issues/4>`_ from OUXT-Polaris/feature/onetbb_src
Feature/onetbb src
* change build order
* remove unused action
* add tbb build command
* fix version
* Contributors: Masaya Kataoka

0.8.1 (2021-07-13)
------------------
* add pkg-config to the depends
* Contributors: Masaya Kataoka

0.0.8 (2021-07-12)
------------------
* fix embree version
* Contributors: Masaya Kataoka

0.0.7 (2021-07-12)
------------------
* remove test lines
* Merge pull request `#3 <https://github.com/OUXT-Polaris/embree_vendor/issues/3>`_ from OUXT-Polaris/workflow/galactic
update CI workflow for galactic
* update .github/workflows/ROS2-Galactic.yaml
* Merge pull request `#2 <https://github.com/OUXT-Polaris/embree_vendor/issues/2>`_ from OUXT-Polaris/workflow/foxy
update CI workflow for foxy
* update .github/workflows/ROS2-Foxy.yaml
* update dependency.repos
* add workflow_dispatch trigger
* Contributors: Masaya Kataoka, robotx_buildfarm

0.0.6 (2021-01-10)
------------------
* Merge pull request `#1 <https://github.com/OUXT-Polaris/embree_vendor/issues/1>`_ from OUXT-Polaris/feature/add_tbb_to_depends
update package.xml
* update package.xml
* update workflow
* rename workflow
* fix workflow
* add generate foxy dpkg workflow
* Contributors: Masaya Kataoka

0.0.5 (2021-01-04)
------------------
* update LICENSE
* add ignore
* Contributors: Masaya Kataoka

0.0.4 (2021-01-03)
------------------
* update release workflow
* Contributors: Masaya Kataoka

0.0.2 (2021-01-03)
------------------
* update version
* update version tag
* update version
* add description
* add Release action
* fix xml tag
* add libglfw3-dev to the depends
* update workflow
* add README.md
* Create ROS2-Foxy.yaml
adding ROS2-Foxy workflow
* update instal dir
* enable pass rostest
* Contributors: Masaya Kataoka
53 changes: 53 additions & 0 deletions external/embree_vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.5)
project(embree_vendor)

# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)

macro(build_embree)

set(cmake_commands)
set(cmake_configure_args
-Wno-dev
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_install
-DEMBREE_ISPC_SUPPORT=OFF)

include(ExternalProject)
externalproject_add(embree-ext
GIT_REPOSITORY https://github.com/embree/embree.git
GIT_TAG v4.1.0
TIMEOUT 6000
${cmake_commands}
CMAKE_ARGS
${cmake_configure_args}
)

# The external project will install to the build folder, but we'll install that on make install.
install(
DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_install/
DESTINATION
${CMAKE_INSTALL_PREFIX}
)
endmacro()

build_embree()

ament_export_include_directories(include)
ament_export_libraries(embree4)

ament_package()
3 changes: 3 additions & 0 deletions external/embree_vendor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# embree_vendor

vendor package for ray-tracing library made by Intel. (https://github.com/embree/embree)
Loading

0 comments on commit f8b6369

Please sign in to comment.