From 11fe2273d12f9b6513273a68a1bc7cbb22fe1698 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 3 Jun 2021 16:44:09 +0200 Subject: [PATCH 1/7] .github/workflows/build.yml: dix DOCKER_REGISTRY arg --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 617ab7ba..ee1fb0cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: | @@ -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 }} From 033e981366053cb4fd4982562c3a58834d1339d1 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 4 Mar 2021 19:49:21 +0100 Subject: [PATCH 2/7] flashers: add docker images for edbg, openocd & jlink --- flashers/edbg.Dockerfile | 46 +++++++++++++++++++++++++++++++++++++ flashers/jlink.Dockerfile | 37 +++++++++++++++++++++++++++++ flashers/openocd.Dockerfile | 35 ++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 flashers/edbg.Dockerfile create mode 100644 flashers/jlink.Dockerfile create mode 100644 flashers/openocd.Dockerfile diff --git a/flashers/edbg.Dockerfile b/flashers/edbg.Dockerfile new file mode 100644 index 00000000..6975a9c1 --- /dev/null +++ b/flashers/edbg.Dockerfile @@ -0,0 +1,46 @@ +ARG DOCKERHUB_REGISTRY="riot" +FROM ubuntu:bionic AS builder + +ARG EDBG_INSTALL_DEPS="git ca-certificates build-essential libudev-dev" +ARG EDBG_VERSION=47c6ba4f7e61b0cce1b724cb62692de6e26a0267 + +# Upgrading system packages to the latest available versions +RUN apt-get update && apt-get -y dist-upgrade +# Installing required packages for flashing toolchain +RUN apt-get -y --no-install-recommends install \ + ${EDBG_INSTALL_DEPS} \ + # Cleaning up installation files + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Compile edbg binary +RUN mkdir -p opt \ + && cd /opt \ + && git clone --depth 1 https://github.com/ataradov/edbg \ + && cd edbg \ + && git checkout -q ${EDBG_VERSION} \ + && make -j"$(nproc)" \ + && make all + +ARG DOCKERHUB_REGISTRY +FROM ${DOCKERHUB_REGISTRY}/riotdocker-base + +LABEL maintainer="francois-xavier.molina@inria.fr" + +ARG FLASH_DEPS="make unzip wget" + +ARG EDBG_DEPS="" + +# Upgrading system packages to the latest available versions +RUN apt-get update && apt-get -y dist-upgrade +# Installing required packages for flashing toolchain +RUN apt-get -y --no-install-recommends install \ + ${EDBG_DEPS} \ + ${FLASH_DEPS} \ + # Cleaning up installation files + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Copy edbg binary from previous stage +COPY --from=builder /opt/edbg/edbg /usr/local/bin/edbg + +# Set default EDBG in the environment +ENV EDBG=/usr/local/bin/edbg diff --git a/flashers/jlink.Dockerfile b/flashers/jlink.Dockerfile new file mode 100644 index 00000000..1858c137 --- /dev/null +++ b/flashers/jlink.Dockerfile @@ -0,0 +1,37 @@ +ARG TARGETPLATFORM +ARG DOCKERHUB_REGISTRY="riot" +FROM ${DOCKERHUB_REGISTRY}/riotdocker-base + +LABEL maintainer="francois-xavier.molina@inria.fr" + +ARG FLASH_DEPS="make unzip" +ARG EDBG_INSTALL_DEPS="wget ca-certificates" + +ARG JLINK_VERSION=694d +ARG JLINK_DEPS="" + +# Upgrading system packages to the latest available versions +RUN apt-get update && apt-get -y dist-upgrade +# Installing required packages for flashing toolchain +RUN apt-get -y --no-install-recommends install \ + ${JLINK_DEPS} \ + ${EDBG_INSTALL_DEPS} \ + ${FLASH_DEPS} \ + # Cleaning up installation files + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Install Jlink +ARG TARGETPLATFORM +ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64} +RUN if [ "${TARGETPLATFORM}" = "linux/amd64" ] ; \ + then export ARCH="x86_64"; \ + elif [ "${TARGETPLATFORM}" = "linux/arm64" ] ; \ + then export ARCH="arm64"; \ + elif [ "${TARGETPLATFORM}" = "linux/arm/v7" ] ; \ + then export ARCH="arm"; \ + fi \ + && echo $ARCH \ + && wget --no-check-certificate --post-data 'accept_license_agreement=accepted&non_emb_ctr=confirmed&submit="Download software"'\ + https://www.segger.com/downloads/jlink/JLink_Linux_V${JLINK_VERSION}_${ARCH}.deb \ + && dpkg --install JLink_Linux_V${JLINK_VERSION}_${ARCH}.deb \ + && rm JLink_Linux_V${JLINK_VERSION}_${ARCH}.deb diff --git a/flashers/openocd.Dockerfile b/flashers/openocd.Dockerfile new file mode 100644 index 00000000..303ed2a1 --- /dev/null +++ b/flashers/openocd.Dockerfile @@ -0,0 +1,35 @@ +ARG DOCKERHUB_REGISTRY="riot" +FROM ${DOCKERHUB_REGISTRY}/riotdocker-base + +LABEL maintainer="francois-xavier.molina@inria.fr" + +ARG FLASH_DEPS="make unzip wget" + +ARG OPENOCD_INSTALL_DEPS="build-essential git ca-certificates libtool pkg-config autoconf automake texinfo \ + libhidapi-hidraw0 libhidapi-dev libusb-1.0" +ARG OPENOCD_VERSION=5f3bc3b279c648f5c751fcd4724206c6ce3e38c6 +ARG OPENOCD_DEPS="" + +# Upgrading system packages to the latest available versions +RUN apt-get update && apt-get -y dist-upgrade +# Installing required packages for flashing toolchain +RUN apt-get -y --no-install-recommends install \ + ${OPENOCD_INSTALL_DEPS} \ + ${OPENOCD_DEPS} \ + ${FLASH_DEPS} \ + # Cleaning up installation files + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Build openocd from source +RUN mkdir -p opt \ + && cd /opt \ + && git clone --depth 1 git://git.code.sf.net/p/openocd/code openocd\ + && cd openocd \ + && git checkout -q ${OPENOCD_VERSION} \ + && ./bootstrap \ + && ./configure --enable-stlink --enable-jlink --enable-ftdi --enable-cmsis-dap \ + && make -j"$(nproc)" \ + && make install-strip \ + && cd .. \ + && rm -rf openocd \ + && rm -rf /var/lib/apt/lists/* From 217361c76018dfa207112156de9bd0781dec7143 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 4 Mar 2021 19:52:03 +0100 Subject: [PATCH 3/7] riotbuild-essential: initial import --- riotbuild-essentials/Dockerfile | 39 +++++++++++++++++++++++++++ riotbuild-essentials/requirements.txt | 18 +++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 riotbuild-essentials/Dockerfile create mode 100644 riotbuild-essentials/requirements.txt diff --git a/riotbuild-essentials/Dockerfile b/riotbuild-essentials/Dockerfile new file mode 100644 index 00000000..0fe15677 --- /dev/null +++ b/riotbuild-essentials/Dockerfile @@ -0,0 +1,39 @@ +ARG DOCKERHUB_REGISTRY="riot" +FROM ${DOCKERHUB_REGISTRY}/static-test-tools + +LABEL maintainer="francois-xavier.molina@inria.fr" + +RUN \ + echo 'Update the package index files to latest available versions' >&2 && \ + apt-get update && \ + echo 'Installing riot-build-essentials' >&2 && \ + apt-get -y --no-install-recommends install \ + # required by RIOT build system + unzip \ + curl \ + # for building many packades + g++ \ + # required for hexdump + bsdmainutils \ + # required for xxd + vim-common \ + cmake \ + patch \ + # To install python packages (next two) + python3-setuptools \ + python3-wheel \ + # For nanopb + protobuf-compiler \ + # For picolibc + ninja-build \ + && \ + echo 'Cleaning up installation files' >&2 && \ + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Install required Python packages +COPY requirements.txt /tmp/requirements.txt +# numpy must be already installed before installing other requirements +RUN pip3 install --no-cache-dir numpy==1.17.4 +RUN echo 'Installing python3 packages' >&2 && \ + pip3 install --no-cache-dir -r /tmp/requirements.txt && \ + rm -f /tmp/requirements.txt diff --git a/riotbuild-essentials/requirements.txt b/riotbuild-essentials/requirements.txt new file mode 100644 index 00000000..d878fd85 --- /dev/null +++ b/riotbuild-essentials/requirements.txt @@ -0,0 +1,18 @@ +# Required python libraries +## For SUIT +cbor==1.0.0 +cbor2>=5.0.0 +colorama>=0.4.0 +cryptography==2.6.1 +ed25519==1.4 +pyhsslms>=1.0.0 +## For emlearn +protobuf==3.10.0 +scikit-learn==0.22.1 +emlearn==0.10.1 +joblib==0.14.0 +## Multiple packages +pyasn1==0.4.2 +ecdsa==0.13.3 +## For kconfig +jinja2 From e99dbdac4328105786eb4515fd862eb8230b9488 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 4 Mar 2021 19:53:54 +0100 Subject: [PATCH 4/7] toolchains: add arm-none-eabi-gcc --- toolchains/gcc-arm-none-eabi.Dockerfile | 12 ++++++++++++ toolchains/gcc-arm-none-eabi.lite.Dockerfile | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 toolchains/gcc-arm-none-eabi.Dockerfile create mode 100644 toolchains/gcc-arm-none-eabi.lite.Dockerfile diff --git a/toolchains/gcc-arm-none-eabi.Dockerfile b/toolchains/gcc-arm-none-eabi.Dockerfile new file mode 100644 index 00000000..453cd5e5 --- /dev/null +++ b/toolchains/gcc-arm-none-eabi.Dockerfile @@ -0,0 +1,12 @@ +ARG DOCKERHUB_REGISTRY="riot" +FROM ${DOCKERHUB_REGISTRY}/gcc-arm-none-eabi.lite as gcc-arm-none-eabi +FROM ${DOCKERHUB_REGISTRY}/riotbuild-essentials + +LABEL maintainer="francois-xavier.molina@inria.fr" + +# Install ARM GNU embedded toolchain +ARG ARM_FOLDER=gcc-arm-none-eabi +RUN mkdir -p /opt/${ARM_FOLDER} +COPY --from=gcc-arm-none-eabi /opt/${ARM_FOLDER} /opt/${ARM_FOLDER} +# Add to PATH +ENV PATH ${PATH}:/opt/${ARM_FOLDER}/bin diff --git a/toolchains/gcc-arm-none-eabi.lite.Dockerfile b/toolchains/gcc-arm-none-eabi.lite.Dockerfile new file mode 100644 index 00000000..435268b5 --- /dev/null +++ b/toolchains/gcc-arm-none-eabi.lite.Dockerfile @@ -0,0 +1,19 @@ +ARG DOCKERHUB_REGISTRY="riot" +FROM ${DOCKERHUB_REGISTRY}/riotdocker-base +LABEL maintainer="francois-xavier.molina@inria.fr" + +# Dependencies to install gcc-arm-none-eabi +ARG ARM_INSTALL_DEPS="curl bzip2" +# Dependencies to compile gcc-arm-none-eabi +ARG ARM_BUILD_DEPS="make unzip" + +# Upgrading system packages to the latest available versions +RUN apt-get update && apt-get -y dist-upgrade +# Installing required packages for flashing toolchain +RUN apt-get -y --no-install-recommends install \ + ${ARM_INSTALL_DEPS} \ + ${ARM_BUILD_DEPS} \ + # Cleaning up installation files + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ENV PATH ${PATH}:/opt/gcc-arm-none-eabi/bin From eb0c06f7c8bf6d00a7ebd9c3160eb8adb665e84d Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 4 Mar 2021 19:57:16 +0100 Subject: [PATCH 5/7] riotbuild: use arm-none-eabi-gcc image --- flashers/edbg.Dockerfile | 6 +++--- flashers/jlink.Dockerfile | 4 ++-- flashers/openocd.Dockerfile | 4 ++-- riotbuild-essentials/Dockerfile | 4 ++-- riotbuild/Dockerfile | 22 ++++++-------------- riotbuild/requirements.txt | 9 +------- toolchains/gcc-arm-none-eabi.Dockerfile | 6 +++--- toolchains/gcc-arm-none-eabi.lite.Dockerfile | 4 ++-- 8 files changed, 21 insertions(+), 38 deletions(-) diff --git a/flashers/edbg.Dockerfile b/flashers/edbg.Dockerfile index 6975a9c1..e0284507 100644 --- a/flashers/edbg.Dockerfile +++ b/flashers/edbg.Dockerfile @@ -1,4 +1,4 @@ -ARG DOCKERHUB_REGISTRY="riot" +ARG DOCKER_REGISTRY="riot" FROM ubuntu:bionic AS builder ARG EDBG_INSTALL_DEPS="git ca-certificates build-essential libudev-dev" @@ -21,8 +21,8 @@ RUN mkdir -p opt \ && make -j"$(nproc)" \ && make all -ARG DOCKERHUB_REGISTRY -FROM ${DOCKERHUB_REGISTRY}/riotdocker-base +ARG DOCKER_REGISTRY +FROM ${DOCKER_REGISTRY}/riotdocker-base LABEL maintainer="francois-xavier.molina@inria.fr" diff --git a/flashers/jlink.Dockerfile b/flashers/jlink.Dockerfile index 1858c137..9d867f9b 100644 --- a/flashers/jlink.Dockerfile +++ b/flashers/jlink.Dockerfile @@ -1,6 +1,6 @@ ARG TARGETPLATFORM -ARG DOCKERHUB_REGISTRY="riot" -FROM ${DOCKERHUB_REGISTRY}/riotdocker-base +ARG DOCKER_REGISTRY="riot" +FROM ${DOCKER_REGISTRY}/riotdocker-base LABEL maintainer="francois-xavier.molina@inria.fr" diff --git a/flashers/openocd.Dockerfile b/flashers/openocd.Dockerfile index 303ed2a1..899b36d8 100644 --- a/flashers/openocd.Dockerfile +++ b/flashers/openocd.Dockerfile @@ -1,5 +1,5 @@ -ARG DOCKERHUB_REGISTRY="riot" -FROM ${DOCKERHUB_REGISTRY}/riotdocker-base +ARG DOCKER_REGISTRY="riot" +FROM ${DOCKER_REGISTRY}/riotdocker-base LABEL maintainer="francois-xavier.molina@inria.fr" diff --git a/riotbuild-essentials/Dockerfile b/riotbuild-essentials/Dockerfile index 0fe15677..a3f98229 100644 --- a/riotbuild-essentials/Dockerfile +++ b/riotbuild-essentials/Dockerfile @@ -1,5 +1,5 @@ -ARG DOCKERHUB_REGISTRY="riot" -FROM ${DOCKERHUB_REGISTRY}/static-test-tools +ARG DOCKER_REGISTRY="riot" +FROM ${DOCKER_REGISTRY}/static-test-tools LABEL maintainer="francois-xavier.molina@inria.fr" diff --git a/riotbuild/Dockerfile b/riotbuild/Dockerfile index 01541add..470acbb4 100644 --- a/riotbuild/Dockerfile +++ b/riotbuild/Dockerfile @@ -20,7 +20,8 @@ # 1. cd to riot root # 2. # docker run -i -t -u $UID -v $(pwd):/data/riotbuild riotbuild ./dist/tools/compile_test/compile_test.py ARG DOCKER_REGISTRY="riot" -FROM ${DOCKER_REGISTRY}/static-test-tools:latest +FROM ${DOCKER_REGISTRY}/gcc-arm-none-eabi as gcc-arm-none-eabi +FROM ${DOCKER_REGISTRY}/riotbuild-essentials:latest LABEL maintainer="Kaspar Schleiser " @@ -107,21 +108,10 @@ RUN \ apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Install ARM GNU embedded toolchain -# For updates, see https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads -ARG ARM_URLBASE=https://developer.arm.com/-/media/Files/downloads/gnu-rm -ARG ARM_URL=${ARM_URLBASE}/9-2019q4/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 -ARG ARM_MD5=fe0029de4f4ec43cf7008944e34ff8cc -ARG ARM_FOLDER=gcc-arm-none-eabi-9-2019-q4-major -RUN echo 'Installing arm-none-eabi toolchain from arm.com' >&2 && \ - mkdir -p /opt && \ - curl -L -o /opt/gcc-arm-none-eabi.tar.bz2 ${ARM_URL} && \ - echo "${ARM_MD5} /opt/gcc-arm-none-eabi.tar.bz2" | md5sum -c && \ - tar -C /opt -jxf /opt/gcc-arm-none-eabi.tar.bz2 && \ - rm -f /opt/gcc-arm-none-eabi.tar.bz2 && \ - echo 'Removing documentation' >&2 && \ - rm -rf /opt/gcc-arm-none-eabi-*/share/doc - # No need to dedup, the ARM toolchain is already using hard links for the duplicated files - +ARG ARM_FOLDER=gcc-arm-none-eabi +RUN mkdir -p /opt/${ARM_FOLDER} +COPY --from=gcc-arm-none-eabi /opt/${ARM_FOLDER} /opt/${ARM_FOLDER} +# Add to PATH ENV PATH ${PATH}:/opt/${ARM_FOLDER}/bin # Install MIPS binary toolchain diff --git a/riotbuild/requirements.txt b/riotbuild/requirements.txt index 001cd8bf..c3dd6288 100644 --- a/riotbuild/requirements.txt +++ b/riotbuild/requirements.txt @@ -1,14 +1,7 @@ # Required python libraries -pyasn1==0.4.2 -ecdsa==0.13.3 -pexpect==4.8.0 +pexpect==4.2.1 pycrypto==2.6.1 pyserial==3.4 -ed25519==1.4 -cbor==1.0.0 -cbor2>=5.0.0 -colorama>=0.4.0 -cryptography==3.2 scapy>=2.4.3 protobuf==3.10.0 scikit-learn==0.22.1 diff --git a/toolchains/gcc-arm-none-eabi.Dockerfile b/toolchains/gcc-arm-none-eabi.Dockerfile index 453cd5e5..30b93c7c 100644 --- a/toolchains/gcc-arm-none-eabi.Dockerfile +++ b/toolchains/gcc-arm-none-eabi.Dockerfile @@ -1,6 +1,6 @@ -ARG DOCKERHUB_REGISTRY="riot" -FROM ${DOCKERHUB_REGISTRY}/gcc-arm-none-eabi.lite as gcc-arm-none-eabi -FROM ${DOCKERHUB_REGISTRY}/riotbuild-essentials +ARG DOCKER_REGISTRY="riot" +FROM ${DOCKER_REGISTRY}/gcc-arm-none-eabi.lite as gcc-arm-none-eabi +FROM ${DOCKER_REGISTRY}/riotbuild-essentials LABEL maintainer="francois-xavier.molina@inria.fr" diff --git a/toolchains/gcc-arm-none-eabi.lite.Dockerfile b/toolchains/gcc-arm-none-eabi.lite.Dockerfile index 435268b5..0f7cf4f2 100644 --- a/toolchains/gcc-arm-none-eabi.lite.Dockerfile +++ b/toolchains/gcc-arm-none-eabi.lite.Dockerfile @@ -1,5 +1,5 @@ -ARG DOCKERHUB_REGISTRY="riot" -FROM ${DOCKERHUB_REGISTRY}/riotdocker-base +ARG DOCKER_REGISTRY="riot" +FROM ${DOCKER_REGISTRY}/riotdocker-base LABEL maintainer="francois-xavier.molina@inria.fr" # Dependencies to install gcc-arm-none-eabi From 26d51b96caebcf9bce641ef3fbbc61154d36ae75 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 4 Mar 2021 20:07:19 +0100 Subject: [PATCH 6/7] .github: add multiarch poc --- .github/workflows/multiarch-poc.yml | 381 ++++++++++++++++++++++++++++ 1 file changed, 381 insertions(+) create mode 100644 .github/workflows/multiarch-poc.yml diff --git a/.github/workflows/multiarch-poc.yml b/.github/workflows/multiarch-poc.yml new file mode 100644 index 00000000..3d4f43a7 --- /dev/null +++ b/.github/workflows/multiarch-poc.yml @@ -0,0 +1,381 @@ +--- +name: multiarch-poc + +on: + push: + branches: + - master + pull_request: + branches: + - '*' +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-static-test-tools: + needs: build-riotdocker-base + name: Build and push static-test-tools + 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 static-test-tools + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache-static + key: ${{ runner.os }}-buildx-static-${{ github.sha }} + restore-keys: ${{ runner.os }}-buildx-static- + + - name: Build and push static-test-tools + uses: docker/build-push-action@v2 + with: + context: ./static-test-tools + file: ./static-test-tools/Dockerfile + platforms: linux/amd64 + pull: true + push: ${{ github.event_name == 'push' }} + tags: ${{ secrets.DOCKERHUB_REGISTRY }}/static-test-tools:latest + build-args: | + DOCKERHUB_REGISTRY=${{ secrets.DOCKERHUB_REGISTRY }} + cache-from: type=local,src=/tmp/.buildx-cache-static + cache-to: type=local,dest=/tmp/.buildx-cache-static-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-static + mv /tmp/.buildx-cache-static-new /tmp/.buildx-cache-static + + build-riotbuild-essentials: + needs: build-static-test-tools + name: Build and push riotbuild-essentials + 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 riotbuild-essentials + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache-riotbuild-essentials + key: ${{ runner.os }}-buildx-riotbuild-essentials-${{ github.sha }} + restore-keys: ${{ runner.os }}-buildx-riotbuild-essentials- + + - name: Build and push riotbuild-essentials + uses: docker/build-push-action@v2 + with: + context: ./riotbuild-essentials + file: ./riotbuild-essentials/Dockerfile + platforms: linux/amd64 + pull: true + push: ${{ github.event_name == 'push' }} + tags: ${{ secrets.DOCKERHUB_REGISTRY }}/riotbuild-essentials:latest + build-args: | + DOCKERHUB_REGISTRY=${{ secrets.DOCKERHUB_REGISTRY }} + cache-from: type=local,src=/tmp/.buildx-cache-riotbuild-essentials + cache-to: type=local,dest=/tmp/.buildx-cache-riotbuild-essentials-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-riotbuild-essentials + mv /tmp/.buildx-cache-riotbuild-essentials-new /tmp/.buildx-cache-riotbuild-essentials + + build-toolchains-base: + needs: build-riotdocker-base + strategy: + fail-fast: false + matrix: + toolchain: [gcc-arm-none-eabi.lite] + name: Build and push ${{ matrix.toolchain }} + env: + ARM_VERSION: gcc-arm-none-eabi-9-2019-q4-major + 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.toolchain }} + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache-${{ matrix.toolchain }} + key: ${{ runner.os }}-buildx-${{ matrix.toolchain }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-buildx-${{ matrix.toolchain }}- + + - name: Build and push ${{ matrix.toolchain }} + uses: docker/build-push-action@v2 + with: + context: . + file: ./toolchains/${{ matrix.toolchain }}.Dockerfile + platforms: linux/amd64,linux/arm64 + pull: true + push: ${{ github.event_name == 'push' }} + tags: | + ${{ secrets.DOCKERHUB_REGISTRY }}/${{ matrix.toolchain }}:latest + ${{ secrets.DOCKERHUB_REGISTRY }}/${{ matrix.toolchain }}:${{ env.ARM_VERSION }} + build-args: | + DOCKERHUB_REGISTRY=${{ secrets.DOCKERHUB_REGISTRY }} + ARM_VERSION=${{ env.ARM_VERSION }} + cache-from: type=local,src=/tmp/.buildx-cache-${{ matrix.toolchain }} + cache-to: type=local,dest=/tmp/.buildx-cache-${{ matrix.toolchain }}-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.toolchain }} + mv /tmp/.buildx-cache-${{ matrix.toolchain }}-new /tmp/.buildx-cache-${{ matrix.toolchain }} + + + build-toolchains: + needs: + - build-riotbuild-essentials + - build-toolchains-base + strategy: + fail-fast: false + matrix: + toolchain: [gcc-arm-none-eabi] + name: Build and push ${{ matrix.toolchain }} + env: + ARM_VERSION: gcc-arm-none-eabi-9-2019-q4-major + 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.toolchain }} + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache-${{ matrix.toolchain }} + key: ${{ runner.os }}-buildx-${{ matrix.toolchain }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-buildx-${{ matrix.toolchain }}- + + - name: Build and push ${{ matrix.toolchain }} + uses: docker/build-push-action@v2 + with: + context: . + file: ./toolchains/${{ matrix.toolchain }}.Dockerfile + platforms: linux/amd64 + pull: true + push: ${{ github.event_name == 'push' }} + tags: | + ${{ secrets.DOCKERHUB_REGISTRY }}/${{ matrix.toolchain }}:latest + ${{ secrets.DOCKERHUB_REGISTRY }}/${{ matrix.toolchain }}:${{ env.ARM_VERSION }} + build-args: | + DOCKERHUB_REGISTRY=${{ secrets.DOCKERHUB_REGISTRY }} + ARM_VERSION=${{ env.ARM_VERSION }} + cache-from: type=local,src=/tmp/.buildx-cache-${{ matrix.toolchain }} + cache-to: type=local,dest=/tmp/.buildx-cache-${{ matrix.toolchain }}-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.toolchain }} + mv /tmp/.buildx-cache-${{ matrix.toolchain }}-new /tmp/.buildx-cache-${{ matrix.toolchain }} + + build-riotbuild: + needs: + - build-static-test-tools + - build-toolchains + name: Build and push riotbuild + 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 riotbuild + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache-riotbuild + key: ${{ runner.os }}-buildx-riotbuild-${{ github.sha }} + restore-keys: ${{ runner.os }}-buildx-riotbuild- + + - name: Build and push riotbuild + uses: docker/build-push-action@v2 + with: + context: ./riotbuild + file: ./riotbuild/Dockerfile + platforms: linux/amd64 + pull: true + push: ${{ github.event_name == 'push' }} + tags: ${{ secrets.DOCKERHUB_REGISTRY }}/riotbuild:latest + build-args: | + DOCKERHUB_REGISTRY=${{ secrets.DOCKERHUB_REGISTRY }} + cache-from: type=local,src=/tmp/.buildx-cache-riotbuild + cache-to: type=local,dest=/tmp/.buildx-cache-riotbuild-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-riotbuild + mv /tmp/.buildx-cache-riotbuild-new /tmp/.buildx-cache-riotbuild + + 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 }} From 5b1960e358cb5a5d91a8af957c475148aa51661d Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 3 Jun 2021 16:57:07 +0200 Subject: [PATCH 7/7] .github/workflows/build-flashers.yml --- .github/workflows/build-flashers.yml | 116 +++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/build-flashers.yml diff --git a/.github/workflows/build-flashers.yml b/.github/workflows/build-flashers.yml new file mode 100644 index 00000000..785fbcfc --- /dev/null +++ b/.github/workflows/build-flashers.yml @@ -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 }}