|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "**" |
| 8 | + tags-ignore: |
| 9 | + - "v[0-9]+.[0-9]+.[0-9]+" |
| 10 | + |
| 11 | +jobs: |
| 12 | + test-proxmox-trixie: |
| 13 | + runs-on: ubuntu-24.04 |
| 14 | + container: |
| 15 | + image: debian:trixie |
| 16 | + steps: |
| 17 | + - name: Install Dependencies |
| 18 | + run: | |
| 19 | + export DEBIAN_FRONTEND=noninteractive |
| 20 | + apt-get update |
| 21 | + apt-get install -y curl |
| 22 | + sh -c "echo deb http://download.proxmox.com/debian/pve trixie pve-no-subscription >> /etc/apt/sources.list" |
| 23 | + curl -o /etc/apt/trusted.gpg.d/proxmox-release-trixie.gpg https://enterprise.proxmox.com/debian/proxmox-release-trixie.gpg |
| 24 | + apt-get update |
| 25 | + apt-get install -y proxmox-archive-keyring |
| 26 | + apt-get upgrade -y |
| 27 | + apt-get install -y build-essential elfutils libelf-dev proxmox-default-kernel proxmox-default-headers |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + path: usb_oc-dkms |
| 32 | + - name: Build Module |
| 33 | + working-directory: usb_oc-dkms |
| 34 | + run: | |
| 35 | + KERNEL_SOURCE_DIR=$(dpkg -L $(dpkg -s $(dpkg -s proxmox-default-headers | grep "Depends: " | cut -d " " -f2) | grep "Depends: " | cut -d " " -f2) | grep -m 1 -Eo ".*/lib/modules/[^/]+/build") |
| 36 | + KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//') |
| 37 | + make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd) |
| 38 | +
|
| 39 | + test-archlinux: |
| 40 | + runs-on: ubuntu-24.04 |
| 41 | + container: |
| 42 | + image: archlinux:base-devel |
| 43 | + steps: |
| 44 | + - name: Install Dependencies |
| 45 | + run: | |
| 46 | + pacman-key --init |
| 47 | + pacman -Syu --noconfirm git linux linux-headers |
| 48 | + - name: Checkout |
| 49 | + uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + path: usb_oc-dkms |
| 52 | + - name: Check Kernel Compatibility |
| 53 | + if: github.event_name != 'workflow_dispatch' |
| 54 | + id: check_kernel |
| 55 | + working-directory: usb_oc-dkms |
| 56 | + run: | |
| 57 | + KERNEL_SOURCE_DIR=$(pacman -Qql linux-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build") |
| 58 | + KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//') |
| 59 | + echo "Detected kernel: $KERNELRELEASE" |
| 60 | +
|
| 61 | + REGEX=$(grep '^BUILD_EXCLUSIVE_KERNEL=' dkms.conf | cut -d'"' -f2) |
| 62 | +
|
| 63 | + if [[ ! "$KERNELRELEASE" =~ $REGEX ]]; then |
| 64 | + echo "Kernel $KERNELRELEASE not supported yet." |
| 65 | + echo "skip_build=true" >> $GITHUB_OUTPUT |
| 66 | + else |
| 67 | + echo "Kernel $KERNELRELEASE is supported." |
| 68 | + echo "skip_build=false" >> $GITHUB_OUTPUT |
| 69 | + fi |
| 70 | + - name: Build Module |
| 71 | + if: github.event_name == 'workflow_dispatch' || steps.check_kernel.outputs.skip_build == 'false' |
| 72 | + working-directory: usb_oc-dkms |
| 73 | + run: | |
| 74 | + KERNEL_SOURCE_DIR=$(pacman -Qql linux-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build") |
| 75 | + KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//') |
| 76 | + sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd) |
| 77 | +
|
| 78 | + test-archlinux-lts: |
| 79 | + runs-on: ubuntu-24.04 |
| 80 | + container: |
| 81 | + image: archlinux:base-devel |
| 82 | + steps: |
| 83 | + - name: Install Dependencies |
| 84 | + run: | |
| 85 | + pacman-key --init |
| 86 | + pacman -Syu --noconfirm git linux-lts linux-lts-headers |
| 87 | + - name: Checkout |
| 88 | + uses: actions/checkout@v4 |
| 89 | + with: |
| 90 | + path: usb_oc-dkms |
| 91 | + - name: Build Module |
| 92 | + working-directory: usb_oc-dkms |
| 93 | + run: | |
| 94 | + KERNEL_SOURCE_DIR=$(pacman -Qql linux-lts-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build") |
| 95 | + KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//') |
| 96 | + sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd) |
| 97 | +
|
| 98 | + test-archlinux-mainline: |
| 99 | + runs-on: ubuntu-24.04 |
| 100 | + container: |
| 101 | + image: archlinux:base-devel |
| 102 | + steps: |
| 103 | + - name: Install Dependencies |
| 104 | + run: | |
| 105 | + pacman-key --init |
| 106 | + cat <<EOF >> /etc/pacman.conf |
| 107 | + [archlinuxcn] |
| 108 | + Server = https://repo.archlinuxcn.org/\$arch |
| 109 | + SigLevel = Never |
| 110 | + EOF |
| 111 | + pacman -Syu --noconfirm git linux-mainline linux-mainline-headers |
| 112 | + - name: Checkout |
| 113 | + uses: actions/checkout@v4 |
| 114 | + with: |
| 115 | + path: usb_oc-dkms |
| 116 | + - name: Check Kernel Compatibility |
| 117 | + if: github.event_name != 'workflow_dispatch' |
| 118 | + id: check_kernel |
| 119 | + working-directory: usb_oc-dkms |
| 120 | + run: | |
| 121 | + KERNEL_SOURCE_DIR=$(pacman -Qql linux-mainline-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build") |
| 122 | + KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//') |
| 123 | + echo "Detected kernel: $KERNELRELEASE" |
| 124 | +
|
| 125 | + REGEX=$(grep '^BUILD_EXCLUSIVE_KERNEL=' dkms.conf | cut -d'"' -f2) |
| 126 | +
|
| 127 | + if [[ ! "$KERNELRELEASE" =~ $REGEX ]]; then |
| 128 | + echo "Kernel $KERNELRELEASE not supported yet." |
| 129 | + echo "skip_build=true" >> $GITHUB_OUTPUT |
| 130 | + else |
| 131 | + echo "Kernel $KERNELRELEASE is supported." |
| 132 | + echo "skip_build=false" >> $GITHUB_OUTPUT |
| 133 | + fi |
| 134 | + - name: Build Module |
| 135 | + if: github.event_name == 'workflow_dispatch' || steps.check_kernel.outputs.skip_build == 'false' |
| 136 | + working-directory: usb_oc-dkms |
| 137 | + run: | |
| 138 | + KERNEL_SOURCE_DIR=$(pacman -Qql linux-mainline-headers | grep -m 1 -Eo ".*/lib/modules/[^/]+/build") |
| 139 | + KERNELRELEASE=$(echo -n "$KERNEL_SOURCE_DIR" | sed 's/.*\/lib\/modules\///g;s/\/build//') |
| 140 | + sudo make -j$(nproc) KERNELRELEASE=$KERNELRELEASE -C $KERNEL_SOURCE_DIR M=$(pwd) |
| 141 | +
|
| 142 | + # test-nixos: |
| 143 | + # runs-on: ubuntu-24.04 |
| 144 | + # steps: |
| 145 | + # - name: "Install Nix" |
| 146 | + # uses: cachix/install-nix-action@v31.5.1 |
| 147 | + # - name: Checkout |
| 148 | + # uses: actions/checkout@v4 |
| 149 | + # with: |
| 150 | + # path: usb_oc-dkms |
| 151 | + # - name: Build i915-sriov kernel module for NixOS |
| 152 | + # working-directory: usb_oc-dkms |
| 153 | + # env: |
| 154 | + # GC_DONT_GC: "1" |
| 155 | + # run: | |
| 156 | + # nix --version |
| 157 | + # nix flake check |
0 commit comments