From dfdb9a1cf3e6c151917f1f0ab6d7cc42c7e85a7e Mon Sep 17 00:00:00 2001 From: Luis Ferreira Date: Sun, 21 Apr 2024 03:35:23 +0100 Subject: [PATCH 1/6] ci(github): add check job before kernel job --- .github/actions/setup-env/action.yml | 40 +++++++ .github/workflows/build.yml | 150 +++++++++++++-------------- 2 files changed, 115 insertions(+), 75 deletions(-) create mode 100644 .github/actions/setup-env/action.yml diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml new file mode 100644 index 000000000000..41887e99e8e9 --- /dev/null +++ b/.github/actions/setup-env/action.yml @@ -0,0 +1,40 @@ +name: Setup environment +inputs: + arch: + required: false + default: x86_64 +runs: + using: composite + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Get and install necessary toolchains + shell: bash + 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 \ + texlive texlive-latex-extra + + if [[ "${{matrix.arch}}" == "arm"* ]]; then + sudo apt-get install gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu qemu-system-arm + fi + + pip install sphinx pyyaml + + 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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0a5932b1c53d..28fb9abe16bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,23 +15,14 @@ jobs: 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: Setup environment + uses: ./.github/actions/setup-env + - name: Build documentation run: | mkdir ${{github.workspace}}/build @@ -47,7 +38,73 @@ jobs: path: docs_${{matrix.target}}.tar retention-days: 90 + check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [ 'alldefconfig', 'allmodconfig', 'allnoconfig', 'allyesconfig' ] + arch: [ 'arm64', 'x86' ] # arm + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + clean: true + + - name: Setup environment + uses: ./.github/actions/setup-env + with: + arch: ${{matrix.arch}} + + - 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: Precheck configuration + run: | + mkdir ${{github.workspace}}/build + + make O=${{github.workspace}}/build -j$(nproc --all) ${{matrix.target}} + make O=${{github.workspace}}/build -j$(nproc --all) archprepare + + # Disabled checks + # make O=${{github.workspace}}/build -j$(nproc --all) includecheck + # make O=${{github.workspace}}/build -j$(nproc --all) kselftest + + - 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: 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 + kernel: + needs: check runs-on: ubuntu-latest strategy: fail-fast: false @@ -92,71 +149,25 @@ jobs: 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: Setup environment + uses: ./.github/actions/setup-env + with: + arch: ${{matrix.arch}} - 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 -j$(nproc --all) ${{matrix.defconfig}} + make O=${{github.workspace}}/build -j$(nproc --all) archprepare - 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 @@ -177,17 +188,6 @@ jobs: 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 . From 8179ccf75ee32fd7834e2a47fe3c95c8a315193a Mon Sep 17 00:00:00 2001 From: Luis Ferreira Date: Sun, 21 Apr 2024 20:04:30 +0100 Subject: [PATCH 2/6] ci(github): remove linkcheckdocs target to docs job --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28fb9abe16bb..d563fa027388 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - target: [ 'htmldocs', 'xmldocs', 'latexdocs', 'pdfdocs', 'epubdocs', 'texinfodocs', 'linkcheckdocs' ] + target: [ 'htmldocs', 'xmldocs', 'latexdocs', 'pdfdocs', 'epubdocs', 'texinfodocs' ] # linkcheckdocs steps: - uses: actions/checkout@v4 with: From 95e0bf9415afe320c083bf972b23dfb2dda72835 Mon Sep 17 00:00:00 2001 From: Luis Ferreira Date: Sun, 21 Apr 2024 20:27:03 +0100 Subject: [PATCH 3/6] ci(github): split test jobs into a seperate workflow --- .github/workflows/build.yml | 12 +-------- .github/workflows/test.yml | 54 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d563fa027388..e9370b24d8e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,6 +70,7 @@ jobs: - name: Precheck configuration run: | + cd ${{github.workspace}} mkdir ${{github.workspace}}/build make O=${{github.workspace}}/build -j$(nproc --all) ${{matrix.target}} @@ -92,17 +93,6 @@ jobs: echo Skipping device-tree overlays build for "$ARCH" fi - - 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 - kernel: needs: check runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000000..019fc60fecab --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +name: Testing + +on: + pull_request: + branches: [ "main" ] + push: + branches: [ "main" ] + workflow_dispatch: + +jobs: + kunit: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arch: [ 'arm64', 'x86' ] # arm + suite: + - drivers/gpu/drm/vc4/tests + - drivers/gpu/drm/tests + - drivers/fpga/tests + - drivers/base/test + - drivers/input/tests + - drivers/hid + - drivers/gpu/drm/ttm/tests + - fs/ext4 + - fs/fat + - kernel/kcsan + - mm/kfence + - net/handshake + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + clean: true + + - name: Setup environment + uses: ./.github/actions/setup-env + with: + arch: ${{matrix.arch}} + + - name: Run kunit testsuite + run: | + mkdir ${{github.workspace}}/build + make O=${{github.workspace}}/build -j$(nproc --all) allyesconfig + + if [[ "$ARCH" == "arm"* ]]; then + ./tools/testing/kunit/kunit.py run \ + --kunitconfig=${{matrix.suite}} \ + --cross_compile=$CROSS_COMPILE --arch=$ARCH + else + ./tools/testing/kunit/kunit.py run \ + --kunitconfig=${{matrix.suite}} + fi From 93425fe64cf79f05bdac9c7bbc2cb72ce42f1af9 Mon Sep 17 00:00:00 2001 From: Luis Ferreira Date: Sun, 21 Apr 2024 20:30:15 +0100 Subject: [PATCH 4/6] ci(github): disable some targets that fails --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e9370b24d8e8..f6f94895cf8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,18 +102,18 @@ jobs: include: - arch: arm defconfig: bcm2835_defconfig - - arch: arm - defconfig: bcmrpi_defconfig + # - arch: arm + # defconfig: bcmrpi_defconfig - arch: arm defconfig: bcm2709_defconfig - arch: arm defconfig: bcm2711_defconfig - - arch: arm - defconfig: multi_v4t_defconfig + # - arch: arm + # defconfig: multi_v4t_defconfig - arch: arm defconfig: multi_v5_defconfig - - arch: arm - defconfig: multi_v7_defconfig + # - arch: arm + # defconfig: multi_v7_defconfig - arch: arm defconfig: mvebu_v5_defconfig - arch: arm From c67f15e70fb299ca7b9dbb64aec791211a05955c Mon Sep 17 00:00:00 2001 From: Luis Ferreira Date: Sun, 21 Apr 2024 20:37:53 +0100 Subject: [PATCH 5/6] ci(github): add precheck for documentation jobs --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6f94895cf8b..9c5a2220d19e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,10 @@ jobs: - name: Build documentation run: | mkdir ${{github.workspace}}/build - make O=${{github.workspace}}/build -j$(nproc --all) ${{matrix.target}} + pip install -r Documentation/sphinx/requirements.txt + + ./scripts/sphinx-pre-install + make SPHINXOPTS=-v O=${{github.workspace}}/build -j$(nproc --all) ${{matrix.target}} - name: Package build artifacts run: tar -cvf docs_${{matrix.target}}.tar -C ${{github.workspace}}/build . From ce7d5dd7e187a506e9c0660b6fb427a5f18f5684 Mon Sep 17 00:00:00 2001 From: Luis Ferreira Date: Sun, 21 Apr 2024 21:32:55 +0100 Subject: [PATCH 6/6] ci(github): add missing environment configs for testing workflows --- .github/workflows/build.yml | 6 +++++- .github/workflows/test.yml | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c5a2220d19e..45b763b5044a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,7 @@ jobs: run: | mkdir ${{github.workspace}}/build pip install -r Documentation/sphinx/requirements.txt - + ./scripts/sphinx-pre-install make SPHINXOPTS=-v O=${{github.workspace}}/build -j$(nproc --all) ${{matrix.target}} @@ -48,6 +48,10 @@ jobs: matrix: target: [ 'alldefconfig', 'allmodconfig', 'allnoconfig', 'allyesconfig' ] arch: [ 'arm64', 'x86' ] # arm + + env: + ARCH: ${{matrix.arch}} + steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 019fc60fecab..0053452faabd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - arch: [ 'arm64', 'x86' ] # arm + arch: [ 'arm', 'arm64', 'x86' ] suite: - drivers/gpu/drm/vc4/tests - drivers/gpu/drm/tests @@ -24,10 +24,18 @@ jobs: - drivers/gpu/drm/ttm/tests - fs/ext4 - fs/fat - - kernel/kcsan - - mm/kfence - net/handshake - + exclude: + - arch: arm + suite: drivers/gpu/drm/ttm/tests + - arch: arm64 + suite: drivers/gpu/drm/ttm/tests + - arch: x86 + suite: drivers/gpu/drm/vc4/tests + + env: + ARCH: ${{matrix.arch}} + steps: - uses: actions/checkout@v4 with: @@ -42,13 +50,15 @@ jobs: - name: Run kunit testsuite run: | mkdir ${{github.workspace}}/build - make O=${{github.workspace}}/build -j$(nproc --all) allyesconfig if [[ "$ARCH" == "arm"* ]]; then ./tools/testing/kunit/kunit.py run \ + --build_dir=${{github.workspace}}/build \ --kunitconfig=${{matrix.suite}} \ --cross_compile=$CROSS_COMPILE --arch=$ARCH else ./tools/testing/kunit/kunit.py run \ + --build_dir=${{github.workspace}}/build \ --kunitconfig=${{matrix.suite}} fi +