All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 2/2] github: Add github action to test build
Date: Mon, 22 Jan 2024 22:36:49 +0100	[thread overview]
Message-ID: <20240122213649.149703-2-hauke@hauke-m.de> (raw)
In-Reply-To: <20240122213649.149703-1-hauke@hauke-m.de>

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@hauke-m.de>
---
 .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


      reply	other threads:[~2024-01-22 21:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 21:36 [PATCH 1/2] backports-update-manager: Add option to not update git trees Hauke Mehrtens
2024-01-22 21:36 ` Hauke Mehrtens [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240122213649.149703-2-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.