From f509c1b1a34c524ed057a989370e193a67dacfc3 Mon Sep 17 00:00:00 2001 From: Andreea Andrisan Date: Mon, 10 Jun 2024 11:38:59 +0300 Subject: [PATCH 1/3] ci/Dockerfile: add file for kuiper2.0 docker image build Using this Dockerfile the docker images for kuiper2.0 are created from scracth by adding the .tar file of the rootfs and installing some dependencies in order to be used for libiio build, or other projects. Signed-off-by: Andreea Andrisan --- ci/Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 ci/Dockerfile diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000000..2a9621ba74 --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,22 @@ +FROM scratch +ADD kuiper_image.tar / +CMD ["/bin/bash"] + +ENV DEBIAN_FRONTEND=noninteractive + +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt update +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y build-essential git wget sudo +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y libxml2-dev bison flex libcdk5-dev cmake +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y libaio-dev libusb-1.0-0-dev libzstd-dev +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y libserialport-dev libavahi-client-dev +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y doxygen graphviz man2html +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y wget curl tar +RUN DEBIAN_FRONTEND=$DEBIAN_FRONTEND apt-get install -y python3 python3-pip python3-setuptools python3-full + +ENV VIRTUAL_ENV=/opt/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN pip3 install sphinx sphinx_rtd_theme furo + +# Cleanup +RUN apt-get clean From 9edb0836c2d649a265c295ec46ba283ac0b3e164 Mon Sep 17 00:00:00 2001 From: Andreea Andrisan Date: Mon, 10 Jun 2024 11:47:08 +0300 Subject: [PATCH 2/3] .github/workflows/docker-image-build.yml: automated docker images build This workflow will be triggered by Kuiper2.0 workflow build after the images were created. In this workflow, the images for 32 and 64 bits basic configurations will be downloaded and docker images will be automatically created from their rootfs folder. Signed-off-by: Andreea Andrisan --- .github/workflows/docker-image-build.yml | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/docker-image-build.yml diff --git a/.github/workflows/docker-image-build.yml b/.github/workflows/docker-image-build.yml new file mode 100644 index 0000000000..4a8b64f92d --- /dev/null +++ b/.github/workflows/docker-image-build.yml @@ -0,0 +1,72 @@ +name: docker image build +on: workflow_dispatch + +jobs: + Build: + runs-on: ubuntu-latest + strategy: + matrix: + kuiper_artifact: [kuiper_basic_32, kuiper_basic_64] + include: + - kuiper_artifact: kuiper_basic_32 + arch: linux/arm + - kuiper_artifact: kuiper_basic_64 + arch: linux/arm64 + steps: + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Checkout Dockerfile for image building + uses: actions/checkout@v4 + with: + sparse-checkout: | + ci/Dockerfile + sparse-checkout-cone-mode: false + + - name: Download image + uses: dawidd6/action-download-artifact@v5 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: kuiper2_0-build.yml + branch: staging/kuiper2.0 + name: ${{ matrix.kuiper_artifact }} + repo: analogdevicesinc/adi-kuiper-gen + + - name: Create .tar file + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + zip_file=$(ls *.zip) + unzip ${zip_file} -d . + img_file=$(ls *.img) + sudo losetup -fP ${img_file} + loop_device=$(losetup --list | grep "$(basename "ADI-Kuiper-Linux.*.img")" | cut -f1 -d' ') + mkdir rootfs + sudo mount "${loop_device}p2" ./rootfs + ( + cd rootfs + sudo tar -cf ../kuiper_image.tar . + ) + sudo umount ./rootfs + sudo losetup -d ${loop_device} + + - name: Test build + run: | + docker buildx create --name armbuilder + docker buildx use armbuilder + docker buildx build --builder armbuilder -t test_kuiper_image --platform ${{ matrix.arch }} --load -f ./ci/Dockerfile . + ARCH_CHECK=$(docker run --platform ${{ matrix.arch }} test_kuiper_image:latest uname -a) + echo "$ARCH_CHECK" + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: aandrisa/${{ matrix.kuiper_artifact }}:latest + file: ci/Dockerfile + context: . + platforms: ${{ matrix.arch }} From 6a5292cfb6601f02031835c684249e2a63f401a8 Mon Sep 17 00:00:00 2001 From: Andreea Andrisan Date: Mon, 10 Jun 2024 12:10:30 +0300 Subject: [PATCH 3/3] .github/workflows/kuiper2_0-build.yml: trigger docker images workflow Add a job that triggers docker image build workflow after a PR is merged to kuiper2.0 default branch and the job that is building the kuiper2.0 images has finished. Signed-off-by: Andreea Andrisan --- .github/workflows/kuiper2_0-build.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/kuiper2_0-build.yml b/.github/workflows/kuiper2_0-build.yml index de4eadf3e3..98b3362d7a 100644 --- a/.github/workflows/kuiper2_0-build.yml +++ b/.github/workflows/kuiper2_0-build.yml @@ -56,3 +56,14 @@ jobs: with: name: ${{ env.ARTIFACT_NAME }} path: ${{ github.workspace }}/kuiper-volume + + Trigger_workflow: + needs: Build + runs-on: ubuntu-latest + if: github.event_name == 'push' + steps: + - uses: actions/checkout@v3 + - name: Trigger docker build + run: gh workflow run docker-image-build.yml --ref staging/kuiper2.0 + env: + GH_TOKEN: ${{ github.token }}