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: CI Multi-Platform Docker Build | ||
# Triggers the workflow on push and pull request events | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build-x86: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
# Step 2: Set up Docker Buildx for multi-platform builds | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
# Step 3: Create a builder instance | ||
- name: Create a builder | ||
run: docker buildx create --use | ||
# Step 4: Build and load Docker image for x86_64 | ||
- name: Build Docker image for x86_64 | ||
run: | ||
docker buildx build \ | ||
--platform linux/amd64 \ | ||
--build-arg HW_ARCH=x86_64 \ | ||
--output=type=docker \ | ||
-t dfki-quad-x86_64 docker/ | ||
# Step 5a: Run the build inside the Docker container for x86_64 | ||
- name: Run build on x86_64 | ||
run: docker run --rm --platform linux/amd64 dfki-quad-x86_64 bash -c "cbg" | ||
build-arm: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
# Step 2: Set up Docker Buildx for multi-platform builds | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
# Step 3: Create a builder instance | ||
- name: Create a builder | ||
run: docker buildx create --use | ||
# Step 4: Build and load Docker image for ARM (Raspberry Pi) locally | ||
- name: Build Docker image for ARM | ||
run: | ||
docker buildx build \ | ||
--platform linux/arm64 \ | ||
--build-arg HW_ARCH=aarch64 \ | ||
--output=type=docker \ | ||
-t dfki-quad-arm docker/ | ||
# Step 5b: Run the build inside the Docker container for ARM | ||
- name: Run build on ARM | ||
run: docker run --rm --platform linux/amd64 dfki-quad-arm dfki-quad bash -c "cbg_onboard" |