REVYOS: ci: add cross/native build #548
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: upstream-cross-kernel | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build-kernel: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: cross | |
| rvtoolchain: 2026.01.01 | |
| board: revyos | |
| runs-on: ubuntu-24.04 | |
| env: | |
| mainline_toolchain: https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/${{ matrix.rvtoolchain }} | |
| mainline_toolchain_file_name: riscv64-glibc-ubuntu-24.04-gcc.tar.xz | |
| wget_alias: 'wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0' | |
| ARCH: riscv | |
| KBUILD_BUILD_USER: riscv | |
| KBUILD_BUILD_HOST: riscv-builder | |
| KDEB_COMPRESS: xz | |
| board: ${{ matrix.board }} | |
| CROSS_COMPILE: riscv64-unknown-linux-gnu- | |
| DEB_BUILD_PROFILES: pkg.linux-upstream.nokernelheaders | |
| TZ: Asia/Shanghai | |
| steps: | |
| - name: Update Apt Cache | |
| run: sudo apt update | |
| - name: Free Disk Space | |
| uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable | |
| with: | |
| remove_android: true | |
| remove_dotnet: true | |
| remove_haskell: true | |
| remove_tool_cache: true | |
| remove_swap: true | |
| remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*" | |
| remove_packages_one_command: true | |
| remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle" | |
| rm_cmd: "rm" # Use 'rmz' for faster deletion (default: 'rm') | |
| rmz_version: "3.1.1" # Required when rm_cmd is 'rmz' | |
| testing: false | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| path: kernel | |
| - name: Install software | |
| run: | | |
| sudo apt install -y gdisk dosfstools g++-riscv64-linux-gnu build-essential \ | |
| libncurses-dev gawk flex bison openssl libssl-dev tree \ | |
| dkms libelf-dev libudev-dev libpci-dev libiberty-dev libdw-dev autoconf \ | |
| device-tree-compiler xz-utils devscripts ccache debhelper bc gcc-riscv64-linux-gnu \ | |
| rustc rust-src bindgen rustfmt rust-clippy | |
| - name: Compile Kernel && Install | |
| run: | | |
| mkdir -p output | |
| ${wget_alias} ${mainline_toolchain}/${mainline_toolchain_file_name} | |
| tar -xvf ${mainline_toolchain_file_name} -C /opt | |
| export PATH="/opt/riscv/bin:$PATH" | |
| ${CROSS_COMPILE}gcc -v | |
| pushd kernel | |
| export KDEB_PKGVERSION="$(make kernelversion)-$(date "+%Y.%m.%d.%H.%M")+$(git rev-parse --short HEAD)" | |
| export RUST_LIB_SRC=/usr/src/rustc-$(rustc --version | cut -d' ' -f2)/library | |
| make debian_defconfig | |
| make -j$(nproc) bindeb-pkg LOCALVERSION="-${board}" | |
| sudo dcmd cp -v ../*.changes ${GITHUB_WORKSPACE}/output | |
| # record commit-id | |
| git rev-parse HEAD > kernel-commitid | |
| sudo cp -v kernel-commitid ${GITHUB_WORKSPACE}/output | |
| popd | |
| - name: 'Upload Artifact' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: kernel-${{ matrix.name }}-${{ matrix.rvtoolchain }}-${{ matrix.board }} | |
| path: output/* | |
| retention-days: 30 |