Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poc/multiarch: proof of concept for multiarch builds, addind flashers and individual toolchain images #138

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .github/workflows/build-flashers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
name: build-flashers

on:
push:
branches:
- master
paths:
- 'flashers/**'
pull_request:
branches:
- '*'
paths:
- 'flashers/**'
jobs:
build-riotdocker-base:
name: Build and push images
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_REGISTRY }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Cache riotdocker-base layer
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache-base
key: ${{ runner.os }}-buildx-base-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-base-

- name: Build and push riotdocker-base
uses: docker/build-push-action@v2
with:
context: ./riotdocker-base
file: ./riotdocker-base/Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
pull: true
push: ${{ github.event_name == 'push' }}
tags: ${{ secrets.DOCKERHUB_REGISTRY }}/riotdocker-base:latest
build-args: |
DOCKERHUB_REGISTRY=${{ secrets.DOCKERHUB_REGISTRY }}
cache-from: type=local,src=/tmp/.buildx-cache-base
cache-to: type=local,dest=/tmp/.buildx-cache-base-new

- name: Move cache
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
run: |
rm -rf /tmp/.buildx-cache-base
mv /tmp/.buildx-cache-base-new /tmp/.buildx-cache-base

build-flashers:
needs: build-riotdocker-base
strategy:
fail-fast: false
matrix:
flasher: [jlink, edbg, openocd]
name: Build and push ${{ matrix.flasher }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_REGISTRY }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Cache ${{ matrix.flasher }}
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache-${{ matrix.flasher }}
key: ${{ runner.os }}-buildx-${{ matrix.flasher }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-${{ matrix.flasher }}-

- name: Build and push ${{ matrix.flasher }}
uses: docker/build-push-action@v2
with:
context: .
file: ./flashers/${{ matrix.flasher }}.Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
pull: true
push: ${{ github.event_name == 'push' }}
tags: ${{ secrets.DOCKERHUB_REGISTRY }}/${{ matrix.flasher }}:latest
build-args: |
DOCKERHUB_REGISTRY=${{ secrets.DOCKERHUB_REGISTRY }}
cache-from: type=local,src=/tmp/.buildx-cache-${{ matrix.flasher }}
cache-to: type=local,dest=/tmp/.buildx-cache-${{ matrix.flasher }}-new

- name: Move cache
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
run: |
rm -rf /tmp/.buildx-cache-${{ matrix.flasher }}
mv /tmp/.buildx-cache-${{ matrix.flasher }}-new /tmp/.buildx-cache-${{ matrix.flasher }}
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
${{ env.DOCKER_REGISTRY }}/static-test-tools:latest
${{ env.DOCKER_REGISTRY }}/static-test-tools:${{ env.RIOT_BRANCH }}
build-args: |
DOCKER_REGISTRY=local
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}

- name: Set environment variables
run: |
Expand All @@ -78,7 +78,7 @@ jobs:
${{ env.DOCKER_REGISTRY }}/riotbuild:latest
${{ env.DOCKER_REGISTRY }}/riotbuild:${{ env.RIOT_BRANCH }}
build-args: |
DOCKER_REGISTRY=local
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
RIOTBUILD_BRANCH=${{ env.RIOTBUILD_BRANCH }}
RIOTBUILD_COMMIT=${{ env.RIOTBUILD_COMMIT }}
RIOTBUILD_VERSION=${{ env.RIOTBUILD_VERSION }}
Expand Down
Loading