test Linux #183
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [x86_64, arm64, riscv, loongarch, arm] | |
| config: [generic.config] | |
| bindgen: [latest] | |
| rustc: [stable] | |
| include: | |
| - arch: x86_64 | |
| config: generic.config no-jump-label.config | |
| bindgen: latest | |
| rustc: stable | |
| - arch: riscv | |
| config: generic.config no-mmu.config | |
| bindgen: latest | |
| rustc: stable | |
| - arch: x86_64 | |
| config: generic.config | |
| bindgen: latest | |
| rustc: 1.78.0 | |
| - arch: x86_64 | |
| config: generic.config | |
| bindgen: latest | |
| rustc: nightly | |
| - arch: arm64 | |
| config: generic.config | |
| bindgen: latest | |
| rustc: nightly | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Resolve bindgen version | |
| run: | | |
| if [[ "${{ matrix.bindgen }}" == "latest" ]]; then | |
| echo "BINDGEN_VERSION=$(gh api repos/rust-lang/rust-bindgen/releases/latest --jq .tag_name | sed 's/^v//')" >> $GITHUB_ENV | |
| else | |
| echo "BINDGEN_VERSION=${{ matrix.bindgen }}" >> $GITHUB_ENV | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libncurses-dev bison flex libssl-dev libelf-dev bc clang lld llvm qemu-system-x86 qemu-system-aarch64 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.rustc }} | |
| components: rust-src, clippy, rustfmt | |
| - name: Cache bindgen | |
| id: cache-bindgen | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/bin/bindgen | |
| key: bindgen-${{ runner.os }}-${{ runner.arch }}-${{ env.BINDGEN_VERSION }} | |
| - name: Install bindgen | |
| if: steps.cache-bindgen.outputs.cache-hit != 'true' | |
| run: cargo install bindgen-cli --version ${{ env.BINDGEN_VERSION }} | |
| - name: Configure kernel | |
| run: | | |
| mkdir -p out | |
| make -C linux O=../out LLVM=1 ARCH=${{ matrix.arch }} allnoconfig | |
| MERGE_LIST="configs/${{ matrix.arch }}.config" | |
| for conf in ${{ matrix.config }}; do | |
| MERGE_LIST="$MERGE_LIST configs/$conf" | |
| done | |
| linux/scripts/kconfig/merge_config.sh -m -O out out/.config $MERGE_LIST | |
| make -C linux O=../out LLVM=1 ARCH=${{ matrix.arch }} olddefconfig | |
| cp out/.config config | |
| - name: Print kernel configuration | |
| run: cat config | |
| - name: Load from cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: out | |
| key: kernel-${{ matrix.arch }}-${{ matrix.config }}-${{ hashFiles('out/.config') }}-${{ github.sha }} | |
| restore-keys: | | |
| kernel-${{ matrix.arch }}-${{ matrix.config }}-${{ hashFiles('out/.config') }}- | |
| - name: Set up incremental compilation | |
| run: | | |
| cmp -s config out/.config || cp config out/.config | |
| cd linux && python3 ../.github/scripts/timestamp.py | |
| - name: Check Rust availability | |
| run: make -C linux O=../out LLVM=1 ARCH=${{ matrix.arch }} rustavailable | |
| - name: Build kernel | |
| run: | | |
| make -C linux O=../out LLVM=1 CLIPPY=1 ARCH=${{ matrix.arch }} -j$(nproc) | |
| - name: Build rustdoc | |
| run: | | |
| make -C linux O=../out LLVM=1 ARCH=${{ matrix.arch }} rustdoc | |
| - name: Run KUnit tests | |
| if: matrix.arch == 'x86_64' || matrix.arch == 'arm64' | |
| working-directory: linux | |
| run: | | |
| ./tools/testing/kunit/kunit.py exec --build_dir=../out --arch=${{ matrix.arch }} --make_options LLVM=1 | |
| build-gcc: | |
| name: build-gcc (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: m68k | |
| compiler: gcc-m68k-linux-gnu | |
| cross_compile: m68k-linux-gnu- | |
| - arch: s390 | |
| compiler: gcc-s390x-linux-gnu | |
| cross_compile: s390x-linux-gnu- | |
| - arch: powerpc | |
| compiler: gcc-powerpc-linux-gnu | |
| cross_compile: powerpc-linux-gnu- | |
| - arch: x86_64 | |
| compiler: gcc | |
| cross_compile: "" | |
| - arch: arm64 | |
| compiler: gcc-aarch64-linux-gnu | |
| cross_compile: aarch64-linux-gnu- | |
| - arch: riscv | |
| compiler: gcc-riscv64-linux-gnu | |
| cross_compile: riscv64-linux-gnu- | |
| - arch: arm | |
| compiler: gcc-arm-linux-gnueabi | |
| cross_compile: arm-linux-gnueabi- | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libncurses-dev bison flex libssl-dev libelf-dev bc ${{ matrix.compiler }} | |
| - name: Configure kernel | |
| run: | | |
| mkdir -p out | |
| make -C linux O=../out ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }} allnoconfig | |
| MERGE_LIST="configs/gcc/generic.config configs/gcc/${{ matrix.arch }}.config" | |
| linux/scripts/kconfig/merge_config.sh -m -O out out/.config $MERGE_LIST | |
| make -C linux O=../out ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }} olddefconfig | |
| cp out/.config config | |
| - name: Print kernel configuration | |
| run: cat config | |
| - name: Load from cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: out | |
| key: kernel-gcc-${{ matrix.arch }}-${{ hashFiles('out/.config') }}-${{ github.sha }} | |
| restore-keys: | | |
| kernel-gcc-${{ matrix.arch }}-${{ hashFiles('out/.config') }}- | |
| - name: Set up incremental compilation | |
| run: | | |
| cmp -s config out/.config || cp config out/.config | |
| cd linux && python3 ../.github/scripts/timestamp.py | |
| - name: Build kernel | |
| run: | | |
| make -C linux O=../out ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }} -j$(nproc) | |
| rustfmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential libncurses-dev bison flex libssl-dev libelf-dev bc clang lld llvm | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, rust-src | |
| - name: Check formatting | |
| run: make -C linux LLVM=1 rustfmtcheck | |
| checkpatch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| fetch-depth: 20 | |
| - name: Fetch referenced commits | |
| working-directory: linux | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if git rev-parse --verify HEAD^2 >/dev/null 2>&1; then | |
| git checkout --detach HEAD^1 | |
| fi | |
| HASHES=$(git log -1 --pretty=%B | tr '\n' ' ' | grep -oP '(?:commit|[\w-]+:)\s+\K[0-9a-f]{12,40}' | sort -u) | |
| for HASH in $HASHES; do | |
| FULL_HASH=$(gh api "repos/torvalds/linux/commits/$HASH" --jq '.sha' 2>/dev/null || true) | |
| if [ -n "$FULL_HASH" ]; then | |
| git fetch origin $FULL_HASH --depth=1 || true | |
| fi | |
| done | |
| - run: git show | |
| working-directory: linux | |
| - name: Run checkpatch | |
| working-directory: linux | |
| run: ./scripts/checkpatch.pl --git HEAD |