[PATCH 2/2] github: Add github action to test build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use github actions to build test changes in backports.

This creates a docker container with the test kernel files to
test compile against. This should get stored persistently.

In addition the patch adds a github action which creates a new
backports tar file and uses this new container to build test the newly
created backports tar.

This allows to build test a backports release using github actions.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 .github/workflows/build_publish_container.yml |  46 +++++++
 .../build_publish_container/Dockerfile        |  16 +++
 .github/workflows/create.yml                  | 115 ++++++++++++++++++
 3 files changed, 177 insertions(+)
 create mode 100644 .github/workflows/build_publish_container.yml
 create mode 100644 .github/workflows/build_publish_container/Dockerfile
 create mode 100644 .github/workflows/create.yml

diff --git a/.github/workflows/build_publish_container.yml b/.github/workflows/build_publish_container.yml
new file mode 100644
index 00000000..d4fabbd5
--- /dev/null
+++ b/.github/workflows/build_publish_container.yml
@@ -0,0 +1,46 @@
+name: Build and publish container
+
+on:
+  workflow_dispatch:
+  push:
+    tags:
+      - 'v*'
+
+env:
+  REGISTRY: ghcr.io
+  IMAGE_NAME: ${{ github.repository }}
+
+jobs:
+  push_to_registry:
+    name: push to registry
+    runs-on: ubuntu-latest
+
+    permissions:
+      contents: read
+      packages: write
+
+    steps:
+      - name: Check out the repo
+        uses: actions/checkout@v4
+      
+      - name: Log in to Docker Hub
+        uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      
+      - name: Extract metadata (tags, labels) for Docker
+        id: meta
+        uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c
+        with:
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+      
+      - name: Build and push Docker image
+        uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
+        with:
+          context: .
+          file: .github/workflows/build_publish_container/Dockerfile
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
diff --git a/.github/workflows/build_publish_container/Dockerfile b/.github/workflows/build_publish_container/Dockerfile
new file mode 100644
index 00000000..1dcdb06f
--- /dev/null
+++ b/.github/workflows/build_publish_container/Dockerfile
@@ -0,0 +1,16 @@
+FROM ubuntu:22.04
+
+RUN apt update && \
+	apt install -y git coccinelle build-essential python3 python3-pip python-is-python3 flex bison libelf1 && \
+	rm -rf /var/lib/apt/lists/*
+
+RUN pip install pyzstd
+
+RUN git clone https://github.com/hauke/backports.git --branch github-action
+
+RUN /backports/devel/backports-update-manager --yes --no-git-update && \
+	rm -rf /ksrc-backports/debs/
+
+RUN rm -rf /backports
+
+WORKDIR /
diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml
new file mode 100644
index 00000000..6ed0a270
--- /dev/null
+++ b/.github/workflows/create.yml
@@ -0,0 +1,115 @@
+name: 'Create backports tar'
+
+on:
+  push:
+
+jobs:
+  create_tar:
+    name: Create backports tar
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Install coccinelle
+        run: |
+          sudo apt update
+          sudo apt install -y coccinelle
+
+      - name: Checkout backports
+        uses: actions/checkout@v4
+        with:
+          path: backports
+
+      - name: Checkout kernel
+        uses: actions/checkout@v4
+        with:
+          repository: gregkh/linux
+          ref: refs/heads/linux-5.15.y
+          path: linux
+
+      - name: Generate backports tar
+        working-directory: backports
+        run: ./gentree.py --refresh  ${GITHUB_WORKSPACE}/linux ${GITHUB_WORKSPACE}/backports-generated
+
+      - name: Check for git changes
+        working-directory: backports
+        run: git diff
+
+      - name: Pack backports-generated.tar.gz
+        run: tar cfz backports-generated.tar.gz backports-generated
+
+      - name: Upload backports-generated.tar.gz
+        uses: actions/upload-artifact@v3
+        with:
+          name: backports-generated.tar.gz
+          path: backports-generated.tar.gz
+
+
+  check_build:
+    name: Test backports tar
+    runs-on: ubuntu-latest
+    container:
+      image: ghcr.io/hauke/backports
+
+    needs: create_tar
+    continue-on-error: true
+    strategy:
+      matrix:
+        kernel: [
+           "4.4",
+           "4.5",
+           "4.6",
+           "4.7",
+           "4.8",
+           "4.9",
+           "4.10",
+           "4.11",
+           "4.12",
+           "4.13",
+           "4.14",
+           "4.15",
+           "4.16",
+           "4.17",
+           "4.18",
+           "4.19",
+           "5.0",
+           "5.1",
+           "5.2",
+           "5.3",
+           "5.4",
+           "5.5",
+           "5.6",
+           "5.7",
+           "5.8",
+           "5.9",
+           "5.10",
+           "5.11",
+           "5.12",
+           "5.13",
+           "5.14",
+           "5.15"]
+        config: [
+           allyesconfig,
+           defconfig-wifi]
+
+    steps:
+      - name: Checkout backports
+        uses: actions/checkout@v4
+        with:
+          path: backports
+
+      - name: Download backports-generated.tar.gz
+        uses: actions/download-artifact@v3
+        with:
+          name: backports-generated.tar.gz
+
+      - name: Unpack backports-generated.tar.gz
+        run: tar xf backports-generated.tar.gz
+
+      - name: Create build configuration
+        working-directory: backports-generated
+        run: make -j$(nproc) KLIB=/ksrc-backports/lib/modules/${{ matrix.kernel }}.*/build/ KLIB_BUILD=/ksrc-backports/lib/modules/${{ matrix.kernel }}.*/build/ ${{ matrix.config }}
+
+      - name: Build
+        working-directory: backports-generated
+        run: make -j$(nproc) KLIB=/ksrc-backports/lib/modules/${{ matrix.kernel }}.*/build/ KLIB_BUILD=/ksrc-backports/lib/modules/${{ matrix.kernel }}.*/build/
+
-- 
2.43.0





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux