• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: libnl3-ci
2
3on:
4  push:
5  pull_request:
6
7env:
8  NLTST_IN_CI: 1
9
10jobs:
11  clang-format:
12    runs-on: ubuntu-latest
13    container:
14      image: fedora:40
15    steps:
16      - name: Install packages
17        run: |
18          sudo dnf install -y \
19            clang-tools-extra \
20            git
21
22      - name: Check out repository code
23        uses: actions/checkout@v3
24
25      - name: Setup git
26        run: |
27          git config --global --add safe.directory "$PWD"
28
29      - name: Formatting with clang-format
30        run: |
31          clang-format --version
32          ./tools/clang-format.sh -n
33
34  ci:
35    strategy:
36      matrix:
37        include:
38          - cc: gcc
39          - cc: clang
40    runs-on: ubuntu-latest
41    steps:
42
43      - name: Install packages
44        run: |
45          sudo apt-get update
46          sudo apt-get -y --no-install-recommends install \
47            check \
48            valgrind \
49            libtool-bin
50
51      - name: Check out repository code
52        uses: actions/checkout@v3
53
54      - name: Setup Python
55        uses: actions/setup-python@v4
56        with:
57          python-version: 3.x
58
59      - name: Lint Python
60        if: ${{ matrix.cc == 'gcc' }}
61        run: |
62          python3 -m pip install flake8
63          flake8 . --count --show-source --statistics
64
65      - name: Code formatting with Python black
66        if: ${{ matrix.cc == 'gcc' }}
67        run: |
68          python3 -m pip install black==22.12.0
69          black --check .
70
71      - name: Build
72        run: |
73          set -x
74
75          export CC="${{ matrix.cc }}"
76          export CFLAGS="-DNL_MORE_ASSERTS=1000 -O2 -Werror -std=gnu11 -fexceptions"
77          CONFIGURE_ARGS=
78          if [ "$CC" = "clang" ]; then
79                  CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument -Wno-error=unused-function"
80                  export LDFLAGS="-Wl,--no-undefined-version,--fatal-warnings"
81                  CONFIGURE_ARGS="--enable-debug=no"
82          else
83                  export LDFLAGS="-Wl,--no-undefined-version"
84          fi
85
86          ./autogen.sh
87          ./configure $CONFIGURE_ARGS
88          make -j 15
89        shell: bash
90
91      - name: Build Unit Tests
92        run: |
93          make -j 15 check-build
94
95      - name: Run Unit Tests
96        run: |
97          set -x
98          export NLTST_SEED_RAND=
99          for i in `seq 1 5`; do
100            tests/check-direct
101            tests/check-all
102            make -j 15 check || (cat ./test-suite.log; false)
103          done
104
105      - name: Run Unit Tests w/Valgrind
106        run: |
107          set -x
108          export NLTST_SEED_RAND=
109          CK_FORK=no libtool --mode=execute valgrind --error-exitcode=66 --leak-check=full -s --show-leak-kinds=all ./tests/check-direct
110          CK_FORK=no libtool --mode=execute valgrind --error-exitcode=66 --leak-check=full -s --show-leak-kinds=all ./tests/check-all
111        shell: bash
112
113      - name: Install packages for Release
114        run: |
115          python3 -m pip install \
116            asciidoc \
117            graphviz \
118            pygments
119          sudo apt-get -y --no-install-recommends install \
120            doxygen \
121            graphviz \
122            mscgen \
123            source-highlight
124
125      - name: Build Release
126        run: |
127          set -x
128          git clean -fdx
129          export CC="${{ matrix.cc }}"
130          NO_GPG_SIGN=1 ./tools/build_release.sh BuildAll
131
132      - name: Build out-of-tree and disable-static
133        run: |
134          set -x
135          git clean -fdx
136          export CC="${{ matrix.cc }}"
137          export CFLAGS="-Werror -std=gnu11 -fexceptions"
138          if [ "$CC" = "clang" ]; then
139                  CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument -Wno-error=unused-function"
140          fi
141
142          ./autogen.sh
143          mkdir build
144          cd build
145          ../configure --disable-static
146          make -j 15
147          make -j 15 check-build
148          export NLTST_SEED_RAND=
149          make -j 15 check || (cat ./test-suite.log; false)
150
151      - name: Link with mold
152        run: |
153          sudo apt-get -y --no-install-recommends install \
154            mold
155          git clean -fdx
156          export LDFLAGS="-fuse-ld=mold -Wl,--fatal-warnings"
157          ./autogen.sh
158          ./configure
159          make -j 15 V=1
160
161      - run: echo "�� This job's status is ${{ job.status }}."
162
163  ci-alpine:
164    runs-on: ubuntu-latest
165    container:
166      image: alpine:latest
167    steps:
168      - name: Install packages
169        run: |
170          apk add \
171            autoconf \
172            automake \
173            bash \
174            bison \
175            check-dev \
176            flex \
177            gcc \
178            git \
179            libtool \
180            linux-headers \
181            make \
182            musl-dev \
183            pkgconfig
184
185      - name: Check out repository code
186        uses: actions/checkout@v3
187
188      - name: Setup git
189        run: |
190          git config --global --add safe.directory "$PWD"
191
192      - name: Build
193        run: |
194          set -x
195
196          export CC="${{ matrix.cc }}"
197          export CFLAGS="-DNL_MORE_ASSERTS=1000 -O2 -Werror -std=gnu11 -fexceptions"
198          if [ "$CC" = "clang" ]; then
199                  CFLAGS="$CFLAGS -Wno-error=unused-command-line-argument -Wno-error=unused-function"
200                  export LDFLAGS="-Wl,--no-undefined-version,--fatal-warnings"
201          else
202                  export LDFLAGS="-Wl,--no-undefined-version"
203          fi
204
205          ./autogen.sh
206          ./configure
207          make -j 15
208
209      - name: Build Unit Tests
210        run: |
211          make -j 15 check-build
212
213      - name: Run Unit Tests
214        run: |
215          set -x
216          export NLTST_SEED_RAND=
217          for i in `seq 1 5`; do
218            tests/check-direct
219            # unshare() does not work (EPERM). This test currently cannot pass
220            # (odd).
221            # tests/check-all
222            # make -j 15 check || (cat ./test-suite.log; false)
223          done
224