Skip to content

Commit

Permalink
Enable multiarch build
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetkillioglu committed Oct 23, 2024
1 parent e937eac commit 65e666f
Showing 1 changed file with 45 additions and 157 deletions.
202 changes: 45 additions & 157 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ env:
jobs:
tii-deb-build:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [amd64, arm64]
steps:
- name: Checkout rmw_fastrtps
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
# Run docker build

- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.platform }}

- name: Run docker builder
env:
ROS: 1
Expand All @@ -34,190 +42,70 @@ jobs:
mkdir bin
git config --global user.email "[email protected]"
git config --global user.name "ci"
PLATFORM=linux/amd64 ./build.sh ./bin/

# Run docker build
# - name: Run foonathan_memory_vendor docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: foonathan_memory_vendor
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: ""
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"
PLATFORM=linux/${{ matrix.platform }} ./build.sh ./bin/

# # Run docker build
# - name: Run Fast-CDR docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: Fast-CDR
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: ""
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"
- uses: docker/setup-buildx-action@v3

# - name: Run Fast-DDS docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: Fast-DDS
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \
# ros-${{env.ROS_DISTRO}}-fastcdr"
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"

# - name: Run rosidl_typesupport_fastrtps/fastrtps_cmake_module docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: rosidl_typesupport_fastrtps/fastrtps_cmake_module
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \
# ros-${{env.ROS_DISTRO}}-fastcdr \
# ros-${{env.ROS_DISTRO}}-fastrtps"
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"

# - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_cpp
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \
# ros-${{env.ROS_DISTRO}}-fastcdr \
# ros-${{env.ROS_DISTRO}}-fastrtps \
# ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module"
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"

# - name: Run rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: rosidl_typesupport_fastrtps/rosidl_typesupport_fastrtps_c
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \
# ros-${{env.ROS_DISTRO}}-fastcdr \
# ros-${{env.ROS_DISTRO}}-fastrtps \
# ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \
# ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp"
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/tiiuae/tii-fastdds-artifacts
tags: |
type=ref,event=branch,suffix=-${{ matrix.platform }}
type=ref,event=pr,suffix=-${{ matrix.platform }}
type=semver,pattern={{version}},suffix=-${{ matrix.platform }}
type=sha,suffix=-${{ matrix.platform }}

# - name: Run rmw_fastrtps/rmw_fastrtps_shared_cpp docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_shared_cpp
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \
# ros-${{env.ROS_DISTRO}}-fastcdr \
# ros-${{env.ROS_DISTRO}}-fastrtps \
# ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \
# ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \
# ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c"
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Run rmw_fastrtps/rmw_fastrtps_dynamic_cpp docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_dynamic_cpp
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \
# ros-${{env.ROS_DISTRO}}-fastcdr \
# ros-${{env.ROS_DISTRO}}-fastrtps \
# ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \
# ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \
# ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \
# ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp"
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"
# - name: Run rmw_fastrtps/rmw_fastrtps_cpp docker build
# env:
# ROS: 1
# IMAGE_NAME: tii_fastdds_builder
# PACKAGE_NAME: rmw_fastrtps/rmw_fastrtps_cpp
# ROS_DISTRO: ${{env.ROS_DISTRO}}
# DEPENDENCIES: "ros-${{env.ROS_DISTRO}}-foonathan-memory-vendor \
# ros-${{env.ROS_DISTRO}}-fastcdr \
# ros-${{env.ROS_DISTRO}}-fastrtps \
# ros-${{env.ROS_DISTRO}}-fastrtps-cmake-module \
# ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-cpp \
# ros-${{env.ROS_DISTRO}}-rosidl-typesupport-fastrtps-c \
# ros-${{env.ROS_DISTRO}}-rmw-fastrtps-shared-cpp"
# run: |
# set -eux
# source build.sh
# build_package $IMAGE_NAME latest $PACKAGE_NAME "$DEPENDENCIES"
- name: Build px4-sitl-gazebo-artifacts image and push
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./Dockerfile.deb_packages
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Upload build
uses: actions/upload-artifact@v4
with:
name: fastdds_debs
name: fastdds_debs_${{ matrix.platform }}
path: bin/*.deb
retention-days: 14

docker_image:
merge_images:
runs-on: ubuntu-latest
needs: tii-deb-build
if: (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_to_docker))
steps:
- name: Checkout rmw_fastrtps
uses: actions/checkout@v4

- name: Download builds
uses: actions/download-artifact@v4
with:
name: fastdds_debs
path: bin/

- uses: docker/setup-buildx-action@v1

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/tiiuae/tii-fastdds-artifacts
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build px4-sitl-gazebo-artifacts image and push
uses: docker/build-push-action@v5
with:
context: .
push: true
file: ./Dockerfile.deb_packages
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Create combined image
run : |
docker manifest create $(echo "${{ steps.meta.outputs.tags }}" | head -1) \
$(echo "${{ steps.meta.outputs.tags }}" | head -1)-amd64 \
$(echo "${{ steps.meta.outputs.tags }}" | head -1)-arm64
docker manifest push $(echo "${{ steps.meta.outputs.tags }}" | head -1)

0 comments on commit 65e666f

Please sign in to comment.