]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
ci: tentative to also build on FreeBSD/NetBSD/OpenBSD
authorVincent Bernat <vincent@bernat.ch>
Thu, 10 Mar 2022 20:41:28 +0000 (21:41 +0100)
committerVincent Bernat <vincent@bernat.ch>
Fri, 11 Mar 2022 22:14:15 +0000 (23:14 +0100)
This could work with NetBSD, but this is far too slow. Give up on it.
Also, use different jobs for Linux and MacOS.

.github/workflows/ci.yml
configure.ac
src/lib/Makefile.am
tests/ci/install.sh
tests/ci/run.sh

index bbabf0035eb21c0c41a5c01e910c2a9c0ddbf494..2add670c7a653fad337030c19d7ff1ad1495fb15 100644 (file)
@@ -5,11 +5,10 @@ on:
   schedule:
     - cron: 0 7 1 * *
 jobs:
-  build:
+  build-linux:
+    runs-on: ubuntu-latest
     strategy:
       matrix:
-        os:
-          - ubuntu-latest
         config-args:
           - "--with-embedded-libevent"
           - "--disable-shared --enable-static"
@@ -23,26 +22,10 @@ jobs:
         release:
           - false
         include:
-          - os: ubuntu-latest
-            config-args: ''
+          - config-args: ''
             release: true
-          - os: ubuntu-latest
-            compiler: clang
+          - compiler: clang
             config-args: "--with-snmp --with-xml"
-          - os: macos-latest
-            compiler: clang
-            config-args: "--with-snmp --with-xml"
-          - os: macos-latest
-            compiler: clang
-            config-args: >
-              --prefix=/usr/local
-              --localstatedir=/var
-              --sysconfdir=/private/etc
-              --with-embedded-libevent
-              --without-snmp
-              --without-xml
-            release: true
-    runs-on: ${{ matrix.os }}
     steps:
       - uses: actions/checkout@v2
         with:
@@ -60,32 +43,91 @@ jobs:
           LLDPD_CONFIG_ARGS: ${{ matrix.config-args }}
           CC: ${{ matrix.compiler }}
       - name: Generate release body
-        if: matrix.release && matrix.os == 'ubuntu-latest'
+        if: matrix.release
         run: ./tests/ci/release.sh > release.md
       - name: Upload release tarball
         uses: actions/upload-artifact@v2
-        if: matrix.release && matrix.os == 'ubuntu-latest'
+        if: matrix.release
         with:
           name: tarball
           path: lldpd-*.tar.gz
           if-no-files-found: error
+      - name: Upload release summary
+        uses: actions/upload-artifact@v2
+        if: matrix.release
+        with:
+          name: release
+          path: release.md
+          if-no-files-found: error
+
+  build-macos:
+    runs-on: macos-latest
+    strategy:
+      matrix:
+        include:
+          - config-args: "--with-snmp --with-xml"
+            release: false
+          - config-args: >
+              --prefix=/usr/local
+              --localstatedir=/var
+              --sysconfdir=/private/etc
+              --with-embedded-libevent
+              --without-snmp
+              --without-xml
+            release: true
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: true
+      - name: Install stuff
+        run: ./tests/ci/install.sh
+      - name: Build and run tests
+        run: ./tests/ci/run.sh
+        env:
+          LLDPD_CONFIG_ARGS: ${{ matrix.config-args }}
+          CC: clang
       - name: Upload MacOS release package
         uses: actions/upload-artifact@v2
-        if: matrix.release && matrix.os == 'macos-latest'
+        if: matrix.release
         with:
           name: package
           path: lldpd-*.pkg
           if-no-files-found: error
-      - name: Upload release summary
-        uses: actions/upload-artifact@v2
-        if: matrix.release && matrix.os == 'ubuntu-latest'
+
+  build-bsd:
+    timeout-minutes: 20
+    strategy:
+      fail-fast: false
+      matrix:
+        os:
+          - name: freebsd
+            version: '13.0'
+            runner: macos-10.15
+          - name: openbsd
+            version: '6.9'
+            runner: macos-10.15
+    runs-on: ${{ matrix.os.runner }}
+    steps:
+      - uses: actions/checkout@v2
         with:
-          name: release
-          path: release.md
-          if-no-files-found: error
+          submodules: true
+      - name: Test on ${{ matrix.os.name }}
+        uses: cross-platform-actions/action@v0.3.1
+        with:
+          operating_system: ${{ matrix.os.name }}
+          version: ${{ matrix.os.version }}
+          environment_variables: LLDPD_CONFIG_ARGS
+          shell: bash
+          run: |
+            set -e
+            ./tests/ci/install.sh
+            ./tests/ci/run.sh
 
   docker:
-    needs: build
+    needs:
+      - build-linux
+      - build-macos
+      - build-bsd
     runs-on: ubuntu-latest
     name: Build Docker images
     if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
@@ -122,7 +164,10 @@ jobs:
           labels: ${{ steps.meta.outputs.labels }}
 
   release:
-    needs: build
+    needs:
+      - build-linux
+      - build-macos
+      - build-bsd
     runs-on: ubuntu-latest
     name: Publish release
     if: startsWith(github.ref, 'refs/tags/')
index 7c87a55fde37fceabd5fcef90c66f0c20dfec429..11ec21a82b5e46c75ad201001566c14d78f399f0 100644 (file)
@@ -48,11 +48,13 @@ AC_PROG_CC_C99
 if test x"$ac_cv_prog_cc_c99" = x"no"; then
   AC_MSG_FAILURE([*** C99 support is mandatory])
 fi
+AC_PROG_CPP
 AM_PROG_CC_C_O
 LT_INIT
 AC_PROG_LN_S
 AC_PROG_EGREP
 AC_PROG_AWK
+AC_PROG_SED
 
 # Check for pkg-config
 m4_ifndef([PKG_CHECK_MODULES], [
index 8763b4fd3f633c32cc9ae731bbbbff2e8fad1908..f98103929eda24011f697506742d9748a16f5e48 100644 (file)
@@ -21,7 +21,7 @@ liblldpctl_la_LIBADD  = $(top_builddir)/src/libcommon-daemon-lib.la libfixedpoin
 
 atom-glue.c: $(ATOM_FILES) Makefile
        $(AM_V_GEN)(for f in $(ATOM_FILES:%=$(srcdir)/%); do \
-               $(CC) -E $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+               $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
                $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $$f; done | \
                $(SED) -n 's+^void init_atom_builder_\([^(]*\)().*, \([0-9]*\)).*+\2 \1+p' | \
                sort | \
@@ -32,7 +32,7 @@ atom-glue.c: $(ATOM_FILES) Makefile
                               for (atom in atoms) { print " init_atom_builder_"atom"();" } \
                               print "}"; }' && \
                for f in $(ATOM_FILES:%=$(srcdir)/%); do \
-               $(CC) -E $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+               $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
                $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $$f; done | \
                $(SED) -n 's+^void init_atom_map_\([^(]*\)().*, \([0-9]*\)).*+\2 \1+p' | \
                sort -n | \
index 7139bdeeaff90ca4b7c063cbff2629480ef0490e..bf93358d3fc8c6b081c6bc9887734ed9842c71bc 100755 (executable)
@@ -3,6 +3,25 @@
 set -e
 
 case "$(uname -s)" in
+    OpenBSD)
+        sudo pkg_add -I \
+             automake-1.16.3 autoconf-2.71 libtool \
+             libevent libxml check \
+             git
+        ;;
+    FreeBSD)
+        sudo env ASSUME_ALWAYS_YES=true pkg install \
+             automake autoconf libtool pkgconf \
+             libevent libxml2 check \
+             git
+        ;;
+    NetBSD)
+        sudo pkgin -y update
+        sudo pkgin -y install \
+             automake autoconf libtool pkg-config \
+             libevent libxml2 check \
+             git
+        ;;
     Darwin)
         brew update > /dev/null
         brew bundle --file=- <<-EOS
index 5f619c04cbd94772118240d3fb9ee643c77dea87..56b781b9cdd55cc6aa860e0f5d6d3b5bccdf4b34 100755 (executable)
@@ -16,6 +16,10 @@ case "$(uname -s)" in
         LLDPD_CONFIG_ARGS="$LLDPD_CONFIG_ARGS LDFLAGS=-mmacosx-version-min=10.9"
         MAKE_ARGS=""
         ;;
+    OpenBSD)
+        export AUTOCONF_VERSION=2.71
+        export AUTOMAKE_VERSION=1.16
+        ;;
 esac
 
 ./autogen.sh
@@ -28,7 +32,6 @@ make check ${MAKE_ARGS-CFLAGS=-Werror} || {
     [ ! -f tests/test-suite.log ] || cat tests/test-suite.log
     exit 1
 }
-make distcheck
 
 case "$(uname -s)" in
     Darwin)
@@ -37,6 +40,8 @@ case "$(uname -s)" in
         otool -l osx/lldpd*/usr/local/sbin/lldpd
         ;;
     Linux)
+        make distcheck
+
         # Integration tests
         cd tests/integration
         sudo $(which python3) -m pytest -n 5 -vv --boxed || \