1name: Cross-build Kernel 2 3on: 4 push: 5 branches: [ main, 'stable/14', 'stable/13' ] 6 pull_request: 7 branches: [ main ] 8 workflow_dispatch: 9 10permissions: 11 contents: read 12 13jobs: 14 build: 15 name: ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) 16 runs-on: ${{ matrix.os }} 17 strategy: 18 fail-fast: false 19 matrix: 20 target_arch: [ amd64, aarch64 ] 21 os: [ ubuntu-20.04, ubuntu-22.04, macos-latest ] 22 include: 23 # TODO: both Ubuntu and macOS have bmake packages, we should try them instead of bootstrapping our own copy. 24 - os: ubuntu-20.04 25 compiler: clang-12 26 cross-bindir: /usr/lib/llvm-12/bin 27 pkgs: bmake libarchive-dev clang-12 lld-12 28 - os: ubuntu-22.04 29 compiler: clang-14 30 cross-bindir: /usr/lib/llvm-14/bin 31 pkgs: bmake libarchive-dev clang-14 lld-14 32 - os: macos-latest 33 compiler: clang-13 34 cross-bindir: /usr/local/opt/llvm@13/bin 35 pkgs: bmake libarchive llvm@13 36 - target_arch: amd64 37 target: amd64 38 - target_arch: aarch64 39 target: arm64 40 steps: 41 - uses: actions/checkout@v4 42 - name: install packages (Ubuntu) 43 if: runner.os == 'Linux' 44 run: | 45 sudo apt-get update --quiet || true 46 sudo apt-get -yq --no-install-suggests --no-install-recommends install ${{ matrix.pkgs }} 47 - name: install packages (macOS) 48 if: runner.os == 'macOS' 49 run: | 50 brew update --quiet || true 51 brew install ${{ matrix.pkgs }} || true 52 - name: create environment 53 run: | 54 echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE" 55 if [ -n "${{ matrix.cross-bindir }}" ]; then 56 echo "EXTRA_BUILD_ARGS=--cross-bindir=${{ matrix.cross-bindir }}" >> $GITHUB_ENV 57 fi 58 mkdir -p ../build 59 echo "MAKEOBJDIRPREFIX=${PWD%/*}/build" >> $GITHUB_ENV 60 # heh, works on Linux/BSD/macOS ... 61 echo "NPROC=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`" >> $GITHUB_ENV 62 - name: bootstrap bmake 63 run: ./tools/build/make.py --debug $EXTRA_BUILD_ARGS TARGET=${{ matrix.target }} TARGET_ARCH=${{ matrix.target_arch }} -n 64 - name: make kernel-toolchain 65 run: ./tools/build/make.py --debug $EXTRA_BUILD_ARGS TARGET=${{ matrix.target }} TARGET_ARCH=${{ matrix.target_arch }} kernel-toolchain -s -j$NPROC -DWITH_DISK_IMAGE_TOOLS_BOOTSTRAP 66 - name: make buildkernel 67 run: ./tools/build/make.py --debug $EXTRA_BUILD_ARGS TARGET=${{ matrix.target }} TARGET_ARCH=${{ matrix.target_arch }} KERNCONF=GENERIC NO_MODULES=yes buildkernel -s -j$NPROC $EXTRA_MAKE_ARGS 68