From 20ce07821bdd6213807ff24c476818d80aedcfa4 Mon Sep 17 00:00:00 2001 From: Vadim Vetrov Date: Fri, 29 Nov 2024 10:09:58 +0300 Subject: [PATCH] Move test builders from cache to docker --- .../kernel-3.0.101.Dockerfile | 12 ++ .../kernel-3.10.108.Dockerfile | 12 ++ .../kernel-4.19.322.Dockerfile | 12 ++ .../kernel-4.4.302.Dockerfile | 12 ++ .../kernel-5.15.167.Dockerfile | 12 ++ .../kernel-5.4.284.Dockerfile | 12 ++ .../kernel-6.6.52.Dockerfile | 12 ++ .github/workflows/test.yml | 119 ++---------------- 8 files changed, 96 insertions(+), 107 deletions(-) create mode 100644 .github/builder_containers/kernel-3.0.101.Dockerfile create mode 100644 .github/builder_containers/kernel-3.10.108.Dockerfile create mode 100644 .github/builder_containers/kernel-4.19.322.Dockerfile create mode 100644 .github/builder_containers/kernel-4.4.302.Dockerfile create mode 100644 .github/builder_containers/kernel-5.15.167.Dockerfile create mode 100644 .github/builder_containers/kernel-5.4.284.Dockerfile create mode 100644 .github/builder_containers/kernel-6.6.52.Dockerfile diff --git a/.github/builder_containers/kernel-3.0.101.Dockerfile b/.github/builder_containers/kernel-3.0.101.Dockerfile new file mode 100644 index 0000000..d46fa44 --- /dev/null +++ b/.github/builder_containers/kernel-3.0.101.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:14.04 + +RUN apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev wget + +RUN wget https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.0.101.tar.xz -O kernel.tar.xz +RUN tar -xf kernel.tar.xz +RUN rm -f kernel.tar.xz +RUN /bin/bash -c "mv linux-* linux" + +WORKDIR /linux +RUN make defconfig +RUN make -j$(nproc) diff --git a/.github/builder_containers/kernel-3.10.108.Dockerfile b/.github/builder_containers/kernel-3.10.108.Dockerfile new file mode 100644 index 0000000..ca166bb --- /dev/null +++ b/.github/builder_containers/kernel-3.10.108.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:16.04 + +RUN apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev wget + +RUN wget https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.10.108.tar.xz -O kernel.tar.xz +RUN tar -xf kernel.tar.xz +RUN rm -f kernel.tar.xz +RUN /bin/bash -c "mv linux-* linux" + +WORKDIR /linux +RUN make defconfig +RUN make -j$(nproc) diff --git a/.github/builder_containers/kernel-4.19.322.Dockerfile b/.github/builder_containers/kernel-4.19.322.Dockerfile new file mode 100644 index 0000000..d87e5e6 --- /dev/null +++ b/.github/builder_containers/kernel-4.19.322.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:24.04 + +RUN apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev wget + +RUN wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.322.tar.xz -O kernel.tar.xz +RUN tar -xf kernel.tar.xz +RUN rm -f kernel.tar.xz +RUN /bin/bash -c "mv linux-* linux" + +WORKDIR /linux +RUN make defconfig +RUN make -j$(nproc) diff --git a/.github/builder_containers/kernel-4.4.302.Dockerfile b/.github/builder_containers/kernel-4.4.302.Dockerfile new file mode 100644 index 0000000..fef15db --- /dev/null +++ b/.github/builder_containers/kernel-4.4.302.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:24.04 + +RUN apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev wget + +RUN wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.302.tar.xz -O kernel.tar.xz +RUN tar -xf kernel.tar.xz +RUN rm -f kernel.tar.xz +RUN /bin/bash -c "mv linux-* linux" + +WORKDIR /linux +RUN make defconfig +RUN make -j$(nproc) diff --git a/.github/builder_containers/kernel-5.15.167.Dockerfile b/.github/builder_containers/kernel-5.15.167.Dockerfile new file mode 100644 index 0000000..810b188 --- /dev/null +++ b/.github/builder_containers/kernel-5.15.167.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:24.04 + +RUN apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev wget + +RUN wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.167.tar.xz -O kernel.tar.xz +RUN tar -xf kernel.tar.xz +RUN rm -f kernel.tar.xz +RUN /bin/bash -c "mv linux-* linux" + +WORKDIR /linux +RUN make defconfig +RUN make -j$(nproc) diff --git a/.github/builder_containers/kernel-5.4.284.Dockerfile b/.github/builder_containers/kernel-5.4.284.Dockerfile new file mode 100644 index 0000000..a38a7e1 --- /dev/null +++ b/.github/builder_containers/kernel-5.4.284.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:24.04 + +RUN apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev wget + +RUN wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.284.tar.xz -O kernel.tar.xz +RUN tar -xf kernel.tar.xz +RUN rm -f kernel.tar.xz +RUN /bin/bash -c "mv linux-* linux" + +WORKDIR /linux +RUN make defconfig +RUN make -j$(nproc) diff --git a/.github/builder_containers/kernel-6.6.52.Dockerfile b/.github/builder_containers/kernel-6.6.52.Dockerfile new file mode 100644 index 0000000..f218ec9 --- /dev/null +++ b/.github/builder_containers/kernel-6.6.52.Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:24.04 + +RUN apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev wget + +RUN wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.52.tar.xz -O kernel.tar.xz +RUN tar -xf kernel.tar.xz +RUN rm -f kernel.tar.xz +RUN /bin/bash -c "mv linux-* linux" + +WORKDIR /linux +RUN make defconfig +RUN make -j$(nproc) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81d19e7..5518ef9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,25 +1,16 @@ -# Tests whether the youtubeUnblock builds properly - name: "youtubeUnblock build test" on: push: - branches: [ "main" ] + branches: + - main paths-ignore: - '.editorconfig' - '.gitignore' - 'LICENSE' - 'README.md' - - pull_request: - branches: [ "main" ] - paths-ignore: - - '.editorconfig' - - '.gitignore' - - 'LICENSE' - - 'README.md' - workflow_dispatch: + pull_request: jobs: prepare: @@ -85,104 +76,18 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - include: - - kernel_version: "6.6.52" - source: "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.52.tar.xz" - container_version: "24.04" - - - kernel_version: "5.15.167" - source: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.167.tar.xz" - container_version: "24.04" - - - kernel_version: "5.4.284" - source: "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.284.tar.xz" - container_version: "24.04" - - - kernel_version: "4.19.322" - source: "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.322.tar.xz" - container_version: "24.04" - - - kernel_version: "4.4.302" - source: "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.302.tar.xz" - container_version: "24.04" - - - kernel_version: "3.10.108" - source: "https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.10.108.tar.xz" - container_version: "16.04" - - - kernel_version: "3.0.101" - source: "https://cdn.kernel.org/pub/linux/kernel/v3.x/linux-3.0.101.tar.xz" - container_version: "14.04" + kernel_version: + - 6.6.52 + - 5.15.167 + - 5.4.284 + - 4.19.322 + - 4.4.302 + - 3.10.108 + - 3.0.101 steps: - name: Checkout uses: actions/checkout@v4 - - name: Restore builder from cache - id: cache-restore - uses: actions/cache/restore@v4 - with: - path: ~/builder.tar - key: builder-${{ matrix.kernel_version }} - - - name: Load builder from cache - if: steps.cache-restore.outputs.cache-hit == 'true' - run: | - docker import - builder < ~/builder.tar - - - name: Prepare build env - if: steps.cache-restore.outputs.cache-hit != 'true' - run: | - mkdir ~/linux - pwd - ls / - ls ~ - - - name: Obtain kernel - if: steps.cache-restore.outputs.cache-hit != 'true' - run: | - cd ~/linux - wget ${{ matrix.source }} -O kernel.tar.xz -q - tar -xf kernel.tar.xz - rm -f kernel.tar.xz - /bin/bash -c "mv linux-* linux" - ls - ls linux - - - name: Install docker - if: steps.cache-restore.outputs.cache-hit != 'true' - run: | - cd ~/linux - docker pull ubuntu:${{ matrix.container_version }} - docker container create --name ubu_builder -w / ubuntu:${{ matrix.container_version }} tail -f /dev/null - docker container start ubu_builder - docker container exec ubu_builder bash -c "apt update && apt install -y build-essential flex bc bison libelf-dev elfutils libssl-dev" - docker cp ./linux ubu_builder:/linux - - - name: Build kernel - if: steps.cache-restore.outputs.cache-hit != 'true' - run: | - cd ~/linux - docker container exec -w /linux ubu_builder bash -c 'make defconfig' - docker container exec -w /linux ubu_builder bash -c 'make -j $(nproc)' - - - name: Export container - if: steps.cache-restore.outputs.cache-hit != 'true' - run: | - cd ~/linux - docker container kill ubu_builder - docker container export ubu_builder > ubu_builder.tar - docker container rm ubu_builder - mv ./ubu_builder.tar ~/builder.tar - docker import - builder < ~/builder.tar - - - name: Save kernel image to cache - if: steps.cache-restore.outputs.cache-hit != 'true' - id: cache-save - uses: actions/cache/save@v4 - with: - path: ~/builder.tar - key: builder-${{ matrix.kernel_version }} - - name: Build kernel module id: build env: @@ -190,7 +95,7 @@ jobs: SHA: ${{ needs.prepare.outputs.sha }} shell: bash run: | - docker run --rm -v ./:/youtubeUnblock -w /youtubeUnblock builder make kmake KERNEL_BUILDER_MAKEDIR:=/linux + docker run --rm -v ./:/youtubeUnblock -w /youtubeUnblock waujito/kernel-bins:${{ matrix.kernel_version }} make kmake KERNEL_BUILDER_MAKEDIR:=/linux tar -czvf kmod-youtubeUnblock-$VERSION-$SHA-linux-${{ matrix.kernel_version }}.tar.gz kyoutubeUnblock.ko - name: Upload artifacts