summaryrefslogtreecommitdiff
path: root/.github/workflows/build-and-run.yml
blob: fb6dd79858919b0a030f7228b4ee6e755b067b98 (plain)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
name: Build and Run

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - master

jobs:
  Build-in-VM:
    #if: ${{ false }} # disable for now
    strategy:
      fail-fast: false
      matrix:
        include:
          - distro: ubuntu-20.04
            pkg-distro: ubuntu20.04
            cpack-type: Ubuntu20
          - distro: ubuntu-22.04
            pkg-distro: ubuntu22.04
            cpack-type: Ubuntu22
          - distro: ubuntu-24.04
            pkg-distro: ubuntu24.04
            cpack-type: Ubuntu24
    runs-on: ${{ matrix.distro }}
    steps:
      - name: Set common vars
        run: |
          echo UNAME_R=`uname -r` >> $GITHUB_ENV
          echo UNAME_M=`uname -m` >> $GITHUB_ENV;
      - name: Install build tools
        run: >
          sudo apt update && 
          NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt -y install
          git build-essential cmake gcc linux-headers-`uname -r`
          libpcre3-dev libssl-dev liblua5.1-0-dev kmod
      - name: Check out repository code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: mkdir build
        run: mkdir build
      - name: cmake
        working-directory: ./build
        run: >
          cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr 
          -DKDIR=/usr/src/linux-headers-`uname -r` 
          -DLUA=TRUE -DSHAPER=FALSE -DRADIUS=TRUE 
          -DCPACK_TYPE=${{ matrix.cpack-type }} ..
      - name: make
        working-directory: ./build
        run: make
      - name: Generate debian package
        working-directory: ./build
        run: cpack -G DEB
      - name: Rename accel-ppp deb package
        working-directory: ./build
        run: >
          mv -v accel-ppp.deb 
          accel-ppp_`git describe --tags --long | sed 's/^v//' | sed 's/-/+/' | sed 's/-/~/'`-1+${{ matrix.pkg-distro }}_`uname -m`.deb
      - name: Install debian package
        working-directory: ./build
        run: NEEDRESTART_SUSPEND=1 sudo -E apt -y install ./accel-ppp*.deb
      - name: Copy default config
        run: sudo cp /etc/accel-ppp.conf.dist /etc/accel-ppp.conf
      - name: Start accel-ppp
        run: sudo systemctl start accel-ppp
      - name: Check accel-ppp running status
        run: sudo systemctl status accel-ppp
      - name: Check accel-ppp stat
        run: accel-cmd show stat
      - name: Upload .deb package as artifact
        uses: actions/upload-artifact@v4
        with:
          name: deb-package-${{ matrix.distro }}-${{ env.UNAME_M }}-${{ env.UNAME_R }}
          path: build/accel-ppp_*.deb
          if-no-files-found: error

  # Debian based distros
  Build-in-Container-Debian:
    #if: ${{ false }} # disable for now
    strategy:
      fail-fast: false
      matrix:
        distro:
          [
            "debian:11",
            "debian:12",
            "debian:trixie",
            "ubuntu:20.04",
            "ubuntu:22.04",
            "ubuntu:24.04"
          ]
    runs-on: ubuntu-24.04
    container:
      image: ${{ matrix.distro }}
    steps:
      - name: Set distro-specific vars
        run: >
          HEADERS_SUFFIX=`uname -m | sed s/aarch64/arm64/ | sed s/x86_64/amd64/`;
          DISTRO=`echo ${{ matrix.distro }} |  sed 's/://'`;
          case "${{ matrix.distro }}" in
          debian:trixie) DISTRO=debian13; CPACK_TYPE=Debian13 ;;
          debian:12) DISTRO=debian12; CPACK_TYPE=Debian12 ;;
          debian:11) CPACK_TYPE=Debian11 ;;
          ubuntu:24.04) CPACK_TYPE=Ubuntu24 ; HEADERS_SUFFIX=generic ;;
          ubuntu:22.04) CPACK_TYPE=Ubuntu22 ; HEADERS_SUFFIX=generic ;;
          ubuntu:20.04) CPACK_TYPE=Ubuntu20 ; HEADERS_SUFFIX=generic ;;
          esac;
          echo HEADERS_SUFFIX=$HEADERS_SUFFIX >> $GITHUB_ENV;
          echo DISTRO=$DISTRO >> $GITHUB_ENV;
          echo CPACK_TYPE=$CPACK_TYPE >> $GITHUB_ENV;
          echo UNAME_M=`uname -m` >> $GITHUB_ENV;
          cat $GITHUB_ENV
      - name: Install build tools
        run: >
          apt update && apt -y upgrade && apt -y dist-upgrade &&
          NEEDRESTART_SUSPEND=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt -y install git build-essential cmake gcc 
          linux-headers-${{ env.HEADERS_SUFFIX }}
          libpcre3-dev libssl-dev liblua5.1-0-dev kmod
      - name: Get kernel name from headers
        run: >
          echo KERNEL_NAME=`ls -1 /usr/src/ | grep  'linux-headers.*${{ env.HEADERS_SUFFIX }}' | 
          sed 's/linux-headers-//'` >> $GITHUB_ENV;
          cat $GITHUB_ENV
      - name: Check out repository code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: mkdir build
        run: mkdir build
      - name: Disable git security warnings
        run: git config --global --add safe.directory '*'
      - name: cmake
        working-directory: ./build
        run: >
          cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr 
          -DKDIR=/usr/src/linux-headers-${{ env.KERNEL_NAME }}
          -DMODULES_KDIR=${{ env.KERNEL_NAME }}
          -DLUA=TRUE -DSHAPER=FALSE -DRADIUS=TRUE 
          -DCPACK_TYPE=${{ env.CPACK_TYPE }} ..
      - name: make
        working-directory: ./build
        run: make
      - name: Generate debian package
        working-directory: ./build
        run: cpack -G DEB
      - name: Rename accel-ppp deb package
        working-directory: ./build
        run: >
          mv -v accel-ppp.deb 
          accel-ppp_`git describe --tags --long | sed 's/^v//' | sed 's/-/+/' | sed 's/-/~/'`-1+${{ env.DISTRO }}_${{ env.UNAME_M }}.deb
      - name: Install debian package
        working-directory: ./build
        run: apt -y install ./accel-ppp*.deb
      - name: Start accel-ppp with default config
        run: accel-pppd -d -c /etc/accel-ppp.conf.dist
      - name: Sleep for 1 sec
        run: sleep 1
      - name: Check accel-ppp stat
        run: accel-cmd show stat
      - name: Upload .deb package as artifact
        uses: actions/upload-artifact@v4
        with:
          name: deb-package-${{ env.DISTRO }}-${{ env.UNAME_M }}-${{ env.KERNEL_NAME }}
          path: build/accel-ppp_*.deb
          if-no-files-found: error

  Build-in-Container-Mainline:
    if: ${{ false }} # disable for now
    runs-on: ubuntu-latest
    container:
      image: ubuntu:devel
    steps:
      - name: Install build tools
        run: >
          apt update && apt -y upgrade && apt -y dist-upgrade &&
          DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true apt -y install git build-essential cmake gcc
          linux-headers-generic libpcre3-dev libssl-dev liblua5.1-0-dev kmod software-properties-common
          pkexec dbus linux-base &&
          add-apt-repository -y ppa:cappelikan/ppa && apt update &&
          service dbus start &&
          apt -y install mainline &&
          mainline --include-rc install-latest &&
          apt -y purge linux-headers-generic && apt -y autoremove
      - name: Get kernel name from headers
        run: >
          echo KERNEL_NAME=`ls -1 /usr/src/ | grep  'linux-headers.*generic' |
          sed 's/linux-headers-//'` >> $GITHUB_ENV;
          cat $GITHUB_ENV
      - name: Check out repository code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: mkdir build
        run: mkdir build
      - name: Disable git security warnings
        run: git config --global --add safe.directory '*'
      - name: cmake
        working-directory: ./build
        run: >
          cmake -DBUILD_IPOE_DRIVER=TRUE -DBUILD_VLAN_MON_DRIVER=TRUE -DCMAKE_INSTALL_PREFIX=/usr
          -DCMAKE_INSTALL_SYSCONFDIR=/etc
          -DKDIR=/usr/src/linux-headers-${{ env.KERNEL_NAME }}
          -DMODULES_KDIR=${{ env.KERNEL_NAME }}
          -DLUA=TRUE -DSHAPER=FALSE -DRADIUS=TRUE ..
      - name: make and install
        working-directory: ./build
        run: make && make install
      - name: Start accel-ppp with default config
        run: accel-pppd -d -c /etc/accel-ppp.conf.dist
      - name: Sleep for 1 sec
        run: sleep 1
      - name: Check accel-ppp stat
        run: accel-cmd show stat

  Build-in-Container-Alpine:
    runs-on: ubuntu-24.04
    container:
      image: alpine:latest
    steps:
      - name: Install build tools
        run: >
          apk update && apk add --no-cache git cmake make g++ pcre-dev libressl-dev linux-headers libucontext-dev lua5.1-dev
      - name: Check out repository code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: mkdir build
        run: mkdir build
      - name: Disable git security warnings
        run: git config --global --add safe.directory '*'
      - name: cmake
        working-directory: ./build
        run: >
          cmake -DBUILD_IPOE_DRIVER=FALSE -DBUILD_VLAN_MON_DRIVER=FALSE -DCMAKE_INSTALL_PREFIX=/usr
          -DKDIR=/usr/src/linux-headers-`uname -r`
          -DLUA=TRUE -DSHAPER=FALSE -DRADIUS=TRUE ..
      - name: make and install
        working-directory: ./build
        run: make && make install
      - name: Copy default config
        run: cp accel-pppd/accel-ppp.conf /etc/accel-ppp.conf
      - name: Start accel-ppp with default config
        run: accel-pppd -d -c /etc/accel-ppp.conf
      - name: Sleep for 1 sec
        run: sleep 1
      - name: Check accel-ppp stat
        run: accel-cmd show stat