summaryrefslogtreecommitdiffstats
path: root/.github/workflows/build-kernel-module.yml
blob: c64de41ea9e3e92f9a6845fb7248ffd6f6bb6789 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build dnbd3 kernel module

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        config:
          - name: CentOS 8.4 [4.18.0]
            build-os: ubuntu-22.04
            kernel-type: centos-rpm
            kernel-source: https://vault.centos.org/8.4.2105/BaseOS/Source/SPackages/kernel-4.18.0-305.25.1.el8_4.src.rpm
          - name: CentOS 8.5 [4.18.0]
            build-os: ubuntu-22.04
            kernel-type: centos-rpm
            kernel-source: https://vault.centos.org/8.5.2111/BaseOS/Source/SPackages/kernel-4.18.0-348.2.1.el8_5.src.rpm
          - name: Rocky 9.3 [5.14.0-362]
            build-os: ubuntu-22.04
            kernel-type: centos-rpm
            kernel-source: https://dl.rockylinux.org/vault/rocky/9.3/BaseOS/source/tree/Packages/k/kernel-5.14.0-362.24.1.el9_3.0.1.src.rpm
          - name: Rocky 9.4 [5.14.0-427]
            build-os: ubuntu-22.04
            kernel-type: centos-rpm
            kernel-source: https://dl.rockylinux.org/vault/rocky/9.4/BaseOS/source/tree/Packages/k/kernel-5.14.0-427.42.1.el9_4.src.rpm
          - name: Rocky 9.5 [5.14.0-503]
            build-os: ubuntu-22.04
            kernel-type: centos-rpm
            kernel-source: https://dl.rockylinux.org/vault/rocky/9.5/BaseOS/source/tree/Packages/k/kernel-5.14.0-503.40.1.el9_5.src.rpm
          - name: Rocky 9.6 [5.14.0-570]
            build-os: ubuntu-22.04
            kernel-type: centos-rpm
            kernel-source: https://dl.rockylinux.org/vault/rocky/9.6/BaseOS/source/tree/Packages/k/kernel-5.14.0-570.22.1.el9_6.src.rpm
          - name: Rocky 10.0 [6.12.0-55]
            build-os: ubuntu-22.04
            kernel-type: centos-rpm
            kernel-source: https://dl.rockylinux.org/pub/rocky/10.0/BaseOS/source/tree/Packages/k/kernel-6.12.0-55.25.1.el10_0.src.rpm
          - name: Vanilla [4.19.x]
            build-os: ubuntu-22.04
            kernel-type: vanilla
            kernel-version: 4.19.y
          - name: Vanilla [5.4.x]
            build-os: ubuntu-22.04
            kernel-type: vanilla
            kernel-version: 5.4.y
          - name: Vanilla [5.10.x]
            build-os: ubuntu-22.04
            kernel-type: vanilla
            kernel-version: 5.10.y
          - name: Vanilla [5.15.x]
            build-os: ubuntu-22.04
            kernel-type: vanilla
            kernel-version: 5.15.y
          - name: Vanilla [6.1.x]
            build-os: ubuntu-22.04
            kernel-type: vanilla
            kernel-version: 6.1.y
          - name: Vanilla [6.6.x]
            build-os: ubuntu-22.04
            kernel-type: vanilla
            kernel-version: 6.6.y
          - name: Vanilla [6.12.x]
            build-os: ubuntu-24.04
            kernel-type: vanilla
            kernel-version: 6.12.y
    name: Build dnbd3 ${{ matrix.config.name }}
    runs-on: ${{ matrix.config.build-os }}
    steps:
      - name: Install dnbd3 dependencies
        run: |
          sudo apt-get update -y -qq
          sudo apt-get install -y -qq make \
                                      clang-format \
                                      libelf-dev \
                                      rpm2cpio \
                                      rpm
      - name: Checkout dnbd3 repository
        uses: actions/checkout@v4
      - name: Fetch dnbd3 repository tags
        run: git fetch --prune --unshallow
      - name: Checkout Vanilla kernel version [git]
        if: matrix.config.kernel-type == 'vanilla'
        run: git clone --depth 1  --branch "linux-${{ matrix.config.kernel-version }}" "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git" "../kernel"
      - name: Checkout CentOS kernel version [rpm]
        if: matrix.config.kernel-type == 'centos-rpm'
        run: |
          mkdir "${{ github.workspace }}/../kernel"
          mkdir "${{ github.workspace }}/../kernel-download"
          wget -q -O "${{ github.workspace }}/../kernel-download/kernel.rpm" "${{ matrix.config.kernel-source }}"
          cd "${{ github.workspace }}/../kernel-download"
          rpm2cpio "${{ github.workspace }}/../kernel-download/kernel.rpm" | cpio --extract --make-directories
          tar --strip 1 -a -x -f linux-*.el*.tar.xz -C "${{ github.workspace }}/../kernel"
          cd
          rm -rf -- "${{ github.workspace }}/../kernel-download"
      - name: Checkout CentOS kernel version [tar]
        if: matrix.config.kernel-type == 'centos-tar'
        run: |
          mkdir "${{ github.workspace }}/../kernel"
          mkdir "${{ github.workspace }}/../kernel-download"
          wget -q -O "${{ github.workspace }}/../kernel-download/kernel.tar.xz" "${{ matrix.config.kernel-source }}"
          tar --strip 1 -a -x -f "${{ github.workspace }}/../kernel-download/kernel.tar.xz" -C "${{ github.workspace }}/../kernel"
          rm -rf -- "${{ github.workspace }}/../kernel-download"
      - name: Configure kernel version
        working-directory: ${{ github.workspace }}/../kernel
        run: |
          make defconfig
          make modules_prepare
      - name: Configure dnbd3 build
        run: |
          cmake -B ${{ github.workspace }}/build \
                -S ${{ github.workspace }} \
                -D CMAKE_BUILD_TYPE=Release \
                -D DNBD3_KERNEL_MODULE=ON \
                -D KERNEL_BUILD_DIR=${{ github.workspace }}/../kernel \
                -D KERNEL_INSTALL_DIR=${{ github.workspace }}/../kernel/extra \
                -D KERNEL_SCRIPTS_DIR=${{ github.workspace }}/../kernel/scripts \
                -D DNBD3_BENCHMARK=OFF \
                -D DNBD3_CLIENT_FUSE=OFF \
                -D DNBD3_SERVER=OFF \
                -D DNBD3_SERVER_FUSE=OFF \
                -D DNBD3_RELEASE_HARDEN=OFF
      - name: Build dnbd3 kernel module
        working-directory: ${{ github.workspace }}/build
        run: make