From a451d91bcdcb4704842d1d5ec201661d3fd6e911 Mon Sep 17 00:00:00 2001 From: Luis Ferreira Date: Wed, 17 Apr 2024 01:57:20 +0100 Subject: [PATCH] ci(github): improve build workflow --- .github/workflows/build.yml | 185 ++++++++++++++++++++++++++ .github/workflows/dtoverlay-check.yml | 44 ------ .github/workflows/kernel-build.yml | 104 --------------- .github/workflows/kunit.yml | 57 -------- 4 files changed, 185 insertions(+), 205 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/dtoverlay-check.yml delete mode 100644 .github/workflows/kernel-build.yml delete mode 100644 .github/workflows/kunit.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000000..cfe6d83277c6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,185 @@ +name: Build + +on: + pull_request: + branches: [ "main" ] + push: + branches: [ "main" ] + workflow_dispatch: + +jobs: + docs: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [ 'htmldocs', 'xmldocs', 'latexdocs', 'pdfdocs', 'epubdocs', 'texinfodocs', 'linkcheckdocs' ] + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Get and install necessary toolchains + run: | + sudo apt-get update + sudo apt-get install texlive texlive-latex-extra + + pip install sphinx pyyaml + timeout-minutes: 15 + + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + clean: true + + - name: Build documentation + run: | + mkdir ${{github.workspace}}/build + make O=${{github.workspace}}/build -j$(nproc --all) ${{matrix.target}} + + - name: Package build artifacts + run: tar -cvf docs_${{matrix.target}}.tar -C ${{github.workspace}}/build . + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: docs_${{matrix.target}} + path: docs_${{matrix.target}}.tar + retention-days: 90 + + kernel: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - arch: arm + defconfig: bcm2835_defconfig + - arch: arm + defconfig: bcmrpi_defconfig + - arch: arm + defconfig: bcm2709_defconfig + - arch: arm + defconfig: bcm2711_defconfig + + - arch: arm64 + defconfig: defconfig + - arch: arm64 + defconfig: bcm2711_defconfig + - arch: arm64 + defconfig: bcm2712_defconfig + + - arch: x86 + defconfig: i386_defconfig + - arch: x86 + defconfig: x86_64_defconfig + + env: + ARCH: ${{matrix.arch}} + + steps: + - name: Get and install necessary toolchains + run: | + sudo apt-get update + + # sudo apt-get build-dep linux linux-image-unsigned-$(uname -r) + sudo apt-get install gcc build-essential libfdt-dev device-tree-compiler \ + libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev \ + libpci-dev libiberty-dev autoconf llvm + + if [[ "${{matrix.arch}}" == "arm"* ]]; then + sudo apt-get install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu qemu-system-arm + fi + timeout-minutes: 15 + + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + clean: true + + - name: Get Raspberry Pi device-tree overlay checker + run: | + git clone https://github.com/raspberrypi/utils "${{github.workspace}}/rpi-utils" + cd "${{github.workspace}}/rpi-utils" + pwd + mkdir build + cd build + pwd + cmake .. + make -j$(nproc --all) + sudo make install + + - name: Prepare build + run: | + mkdir ${{github.workspace}}/build + + if [[ "$ARCH" == "arm64" ]]; then + export CROSS_COMPILE=aarch64-linux-gnu- + export IMAGE=Image.gz + elif [[ "${{matrix.arch}}" == "arm" ]]; then + export CROSS_COMPILE=arm-linux-gnueabihf- + export IMAGE=zImage + else + export IMAGE=bzImage + fi + echo "CROSS_COMPILE=${CROSS_COMPILE}" >> $GITHUB_ENV + echo "IMAGE=${IMAGE}" >> $GITHUB_ENV + + make O=${{github.workspace}}/build ${{matrix.defconfig}} + scripts/config --file ${{github.workspace}}/build/.config --set-val CONFIG_WERROR y + + make O=${{github.workspace}}/build archprepare + + - name: Build device-tree overlays + run: | + if [[ "$ARCH" == "arm"* ]]; then + mkdir -p ${{github.workspace}}/install/boot/overlays + + make O=${{github.workspace}}/build -j$(nproc --all) dtbs + + cp ${{github.workspace}}/build/scripts/dtc/dtc ${{github.workspace}}/scripts/dtc/dtc + ${{github.workspace}}/rpi-utils/overlaycheck/overlaycheck + else + echo Skipping device-tree overlays build for "$ARCH" + fi + + - name: Build kernel + run: make O=${{github.workspace}}/build -j$(nproc --all) vmlinux + + - name: Build kernel modules + run: | + make O=${{github.workspace}}/build -j$(nproc --all) modules + make O=${{github.workspace}}/build \ + INSTALL_PATH=${{github.workspace}}/install \ + INSTALL_MOD_PATH=${{github.workspace}}/install \ + modules_install + + - name: Build kernel image + run: | + mkdir -p ${{github.workspace}}/install + + make O=${{github.workspace}}/build -j$(nproc --all) $IMAGE + make O=${{github.workspace}}/build \ + INSTALL_PATH=${{github.workspace}}/install \ + install + + - name: Run kunit testsuite + run: | + if [[ "$ARCH" == "arm"* ]]; then + ./tools/testing/kunit/kunit.py run \ + --kunitconfig=drivers/gpu/drm/vc4/tests \ + --cross_compile=$CROSS_COMPILE --arch=$ARCH + else + ./tools/testing/kunit/kunit.py run \ + --kunitconfig=drivers/gpu/drm/tests + fi + + - name: Package build artifacts + run: tar -cvf kernel_${{matrix.arch}}_${{matrix.defconfig}}.tar -C ${{github.workspace}}/install . + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: kernel_${{matrix.arch}}_${{matrix.defconfig}} + path: kernel_${{matrix.arch}}_${{matrix.defconfig}}.tar + retention-days: 90 diff --git a/.github/workflows/dtoverlay-check.yml b/.github/workflows/dtoverlay-check.yml deleted file mode 100644 index f643985d603c..000000000000 --- a/.github/workflows/dtoverlay-check.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Device-tree overlay checks - -on: - pull_request: - branches: [ "main" ] - push: - branches: [ "main" ] - workflow_dispatch: - -env: - UTILS_DIR: "${{github.workspace}}/rpi-utils" - -jobs: - dtoverlaycheck: - runs-on: ubuntu-latest - - steps: - - name: Install toolchain - run: | - sudo apt update - sudo apt-get install gcc-arm-linux-gnueabihf libfdt-dev device-tree-compiler - timeout-minutes: 10 - - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - clean: true - - - name: Raspberry Pi device-tree overlay checks - run: | - git clone https://github.com/raspberrypi/utils ${{env.UTILS_DIR}} - cd ${{env.UTILS_DIR}} - pwd - mkdir build - cd build - pwd - cmake .. - make -j4 - sudo make install - cd ${{github.workspace}} - pwd - make ARCH=arm KERNEL=kernel CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig - make ARCH=arm KERNEL=kernel CROSS_COMPILE=arm-linux-gnueabihf- dtbs - ${{env.UTILS_DIR}}/overlaycheck/overlaycheck diff --git a/.github/workflows/kernel-build.yml b/.github/workflows/kernel-build.yml deleted file mode 100644 index fb190b06081a..000000000000 --- a/.github/workflows/kernel-build.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Kernel build - -on: - pull_request: - branches: [ "main" ] - push: - branches: [ "main" ] - workflow_dispatch: - -env: - NUM_JOBS: 3 - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - name: bcm2835 - arch: arm - defconfig: bcm2835_defconfig - kernel: kernel - - - name: arm64 - arch: arm64 - defconfig: defconfig - kernel: kernel8 - - - name: bcmrpi - arch: arm - defconfig: bcmrpi_defconfig - kernel: kernel - - - name: bcm2709 - arch: arm - defconfig: bcm2709_defconfig - kernel: kernel7 - - - name: bcm2711 - arch: arm - defconfig: bcm2711_defconfig - kernel: kernel7l - - - name: bcm2711_arm64 - arch: arm64 - defconfig: bcm2711_defconfig - kernel: kernel8 - - - name: bcm2712 - arch: arm64 - defconfig: bcm2712_defconfig - kernel: kernel_2712 - - steps: - - name: Update install - run: - sudo apt-get update - - - name: Install toolchain - run: - if [[ "${{matrix.arch}}" == "arm64" ]]; then - sudo apt-get install gcc-aarch64-linux-gnu; - else - sudo apt-get install gcc-arm-linux-gnueabihf; - fi - timeout-minutes: 5 - - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - clean: true - - - name: Build kernel ${{matrix.name}} - run: | - mkdir ${{github.workspace}}/build - export ARCH=${{matrix.arch}} - if [[ "$ARCH" == "arm64" ]]; then - export CROSS_COMPILE=aarch64-linux-gnu- - export DTS_SUBDIR=broadcom - export IMAGE=Image.gz - else - export CROSS_COMPILE=arm-linux-gnueabihf- - export DTS_SUBDIR=broadcom - export IMAGE=zImage - fi - make O=${{github.workspace}}/build ${{matrix.defconfig}} - scripts/config --file ${{github.workspace}}/build/.config --set-val CONFIG_WERROR y - make O=${{github.workspace}}/build -j ${{env.NUM_JOBS}} $IMAGE modules dtbs - mkdir -p ${{github.workspace}}/install/boot/overlays - make O=${{github.workspace}}/build INSTALL_MOD_PATH=${{github.workspace}}/install modules_install - cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/${DTS_SUBDIR}/*.dtb ${{github.workspace}}/install/boot/ - cp ${{github.workspace}}/build/arch/${ARCH}/boot/dts/overlays/*.dtb* ${{github.workspace}}/install/boot/overlays/ - cp ${{github.workspace}}/arch/${ARCH}/boot/dts/overlays/README ${{github.workspace}}/install/boot/overlays/ - cp ${{github.workspace}}/build/arch/${ARCH}/boot/$IMAGE ${{github.workspace}}/install/boot/${{matrix.kernel}}.img - - - name: Tar build - run: tar -cvf ${{matrix.name}}_build.tar -C ${{github.workspace}}/install . - - - name: Upload results - uses: actions/upload-artifact@v4 - with: - name: ${{matrix.name}}_build - path: ${{matrix.name}}_build.tar - retention-days: 90 diff --git a/.github/workflows/kunit.yml b/.github/workflows/kunit.yml deleted file mode 100644 index 1ad7c62bc1ee..000000000000 --- a/.github/workflows/kunit.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: KUnit Tests - -on: - pull_request: - branches: [ "main" ] - push: - branches: [ "main" ] - workflow_dispatch: - -jobs: - core: - name: Generic DRM/KMS Unit Tests - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Run Generic DRM Tests - run: | - echo Skipping ./tools/testing/kunit/kunit.py run \ - --kunitconfig=drivers/gpu/drm/tests - - vc4-arm: - name: VC4 Unit Tests on ARM - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y gcc-arm-linux-gnueabihf qemu-system-arm - - - name: Run VC4 Tests - run: | - ./tools/testing/kunit/kunit.py run \ - --kunitconfig=drivers/gpu/drm/vc4/tests \ - --cross_compile=arm-linux-gnueabihf- --arch=arm - - vc4-arm64: - name: VC4 Unit Tests on ARM64 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu qemu-system-arm - - - name: Run VC4 Tests - run: | - ./tools/testing/kunit/kunit.py run \ - --kunitconfig=drivers/gpu/drm/vc4/tests \ - --cross_compile=aarch64-linux-gnu- --arch=arm64