Enable multiarch builds with ros baseimage #60
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: humble-build | |
on: | |
push: | |
branches: [ humble ] | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
branches: [ humble ] | |
workflow_dispatch: | |
inputs: | |
push_to_docker: | |
description: 'Push packages to docker image?' | |
required: true | |
default: true | |
type: boolean | |
permissions: | |
contents: read | |
packages: write | |
env: | |
ROS_DISTRO: humble | |
jobs: | |
tii-deb-build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
architecture: [amd64, arm64] | |
steps: | |
- name: Checkout rmw_fastrtps | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ matrix.architecture }} | |
- name: Run deb package build | |
env: | |
ROS: 1 | |
IMAGE_NAME: tii_fastdds_builder | |
run: | | |
set -eux | |
mkdir bin | |
git config --global user.email "[email protected]" | |
git config --global user.name "ci" | |
PLATFORM=linux/${{ matrix.architecture }} ./build.sh ./bin/ | |
- uses: docker/setup-buildx-action@v3 | |
- 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.architecture }} | |
type=ref,event=pr,suffix=-${{ matrix.architecture }} | |
type=semver,pattern={{version}},suffix=-${{ matrix.architecture }} | |
type=sha,suffix=-${{ matrix.architecture }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build tii-fastdds-artifacts image and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: linux/${{ matrix.architecture }} | |
file: ./Dockerfile.deb_packages | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
provenance: false | |
- name: Upload build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fastdds_debs_${{ matrix.architecture }} | |
path: bin/*.deb | |
retention-days: 14 | |
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: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/tiiuae/tii-fastdds-artifacts | |
tags: | | |
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: Create combined image | |
run : | | |
echo "Debug: Tags are ${{ steps.meta.outputs.tags }}" | |
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) |