merge arm cross compilation #351
Workflow file for this run
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: C/C++ CI docker | |
on: [push] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
dockerfile: Dockerfile.windows | |
arch: windows | |
- os: ubuntu-latest | |
dockerfile: Dockerfile.arm64 | |
arch: arm64 | |
image: arm64v8/ubuntu | |
- os: ubuntu-latest | |
dockerfile: Dockerfile.rpi | |
arch: armv6l | |
crosscompiler: https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Buster/GCC%2010.2.0/Raspberry%20Pi%201%2C%20Zero/cross-gcc-10.2.0-pi_0-1.tar.gz | |
image: balenalib/raspberry-pi | |
- os: ubuntu-latest | |
dockerfile: Dockerfile.rpi | |
arch: armv7l | |
crosscompiler: https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Buster/GCC%2010.2.0/Raspberry%20Pi%202%2C%203/cross-gcc-10.2.0-pi_2-3.tar.gz | |
image: balenalib/raspberry-pi2 | |
- os: ubuntu-latest | |
dockerfile: Dockerfile | |
arch: amd64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build an image from Dockerfile | |
run: | | |
docker build -t docker.io/${{ github.repository }}:${{ github.base_ref || github.ref_name }}-${{ matrix.arch }} -f ${{ matrix.dockerfile }} --build-arg CROSSCOMPILER=${{ matrix.crosscompiler }} --build-arg ARCH=${{ matrix.arch }} --build-arg IMAGE=${{ matrix.image }} . | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push to Container Registry | |
run: | | |
docker push docker.io/${{ github.repository }}:${{ github.base_ref || github.ref_name }}-${{ matrix.arch }} | |
multiarch: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish multiarch image | |
env: | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
run: | | |
docker info | |
export TAG=${{ github.base_ref || github.ref_name }} | |
export MANIFEST=${TAG} | |
[ "$TAG" == "master" ] && export MANIFEST=latest | |
docker manifest create --amend docker.io/${{ github.repository }}:${MANIFEST} docker.io/${{ github.repository }}:${TAG}-amd64 docker.io/${{ github.repository }}:${TAG}-armv7l docker.io/${{ github.repository }}:${TAG}-armv6l docker.io/${{ github.repository }}:${TAG}-windows docker.io/${{ github.repository }}:${TAG}-arm64 | |
docker manifest annotate docker.io/${{ github.repository }}:${MANIFEST} docker.io/${{ github.repository }}:${TAG}-armv7l --os linux --arch arm --variant v7 | |
docker manifest annotate docker.io/${{ github.repository }}:${MANIFEST} docker.io/${{ github.repository }}:${TAG}-armv6l --os linux --arch arm --variant v6l | |
docker manifest push docker.io/${{ github.repository }}:${MANIFEST} -p |