diff mbox series

[ovs-dev,5/5] ci: Add jobb for building the deb package.

Message ID 20220805203452.3060165-6-frode.nordahl@canonical.com
State Deferred
Headers show
Series debian: Update debian package source. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Frode Nordahl Aug. 5, 2022, 8:34 p.m. UTC
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
---
 .ci/linux-build.sh         | 33 +++++++++++++++++++++++++
 .ci/linux-prepare.sh       |  6 +++++
 .github/workflows/test.yml | 49 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 88 insertions(+)
diff mbox series

Patch

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index dc32564fa..6a2226223 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -69,9 +69,42 @@  if [ "$TESTSUITE" ]; then
             exit 1
         fi
     fi
+elif [ "$DEB_PACKAGE" ]; then
+    configure_ovn
+    make debian
+
+    # There is a pending SRU to the Ubuntu Open vSwitch package that allows
+    # building OVN 22.03.1 and onwards.  Let's use the Debian package until
+    # it arrives.
+    deb_ovs_pool=http://ftp.debian.org/debian/pool/main/o/openvswitch
+    wget -O /tmp/openvswitch-source_2.17.2-3_all.deb \
+        $deb_ovs_pool/openvswitch-source_2.17.2-3_all.deb
+    sudo dpkg -i /tmp/openvswitch-source_2.17.2-3_all.deb
+
+    mk-build-deps --install --root-cmd sudo --remove debian/control
+    dpkg-checkbuilddeps
+    make debian-deb
+    packages=$(ls $(pwd)/../*.deb)
+    deps=""
+    for pkg in $packages; do
+        _ifs=$IFS
+        IFS=","
+        for dep in $(dpkg-deb -f $pkg Depends); do
+            dep_name=$(echo "$dep"|awk '{print$1}')
+            # Don't install internal package inter-dependencies from apt
+            echo $dep_name | grep -q ovn && continue
+            deps+=" $dep_name"
+        done
+        IFS=$_ifs
+    done
+    # install package dependencies from apt
+    echo $deps | xargs sudo apt -y install
+    # install the locally built openvswitch packages
+    sudo dpkg -i $packages
 else
     configure_ovn $OPTS
     make -j4 || { cat config.log; exit 1; }
 fi
 
+
 exit 0
diff --git a/.ci/linux-prepare.sh b/.ci/linux-prepare.sh
index e0c528479..6d73f1535 100755
--- a/.ci/linux-prepare.sh
+++ b/.ci/linux-prepare.sh
@@ -2,6 +2,12 @@ 
 
 set -ev
 
+if [ "$DEB_PACKAGE" ]; then
+    # We're not using sparse for debian packages, tests are skipped and
+    # all extra dependencies tracked by mk-build-deps.
+    exit 0
+fi
+
 # Build and install sparse.
 #
 # Explicitly disable sparse support for llvm because some travis
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 3b7283229..973fb9666 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -169,3 +169,52 @@  jobs:
       with:
         name: logs-osx-clang---disable-ssl
         path: config.log
+
+  build-linux-deb:
+    env:
+      deb_dependencies: |
+        build-essential fakeroot devscripts equivs
+      DEB_PACKAGE: yes
+      DEB_HOST_ARCH: amd64
+
+    name: linux deb
+    runs-on: ubuntu-22.04
+    timeout-minutes: 30
+
+    strategy:
+      fail-fast: false
+
+    steps:
+    - name: checkout self
+      uses: actions/checkout@v2
+      with:
+        submodules: recursive
+
+    - name: checkout ovn-vif
+      uses: actions/checkout@v2
+      with:
+        repository: 'ovn-org/ovn-vif'
+        path: 'ovn-vif'
+        ref: 'main'
+
+    - name: update PATH
+      run:  |
+        echo "$HOME/bin"        >> $GITHUB_PATH
+        echo "$HOME/.local/bin" >> $GITHUB_PATH
+
+    - name: update APT cache
+      run:  sudo apt update || true
+    - name: install dependencies for debian packages
+      run:  sudo apt install -y ${{ env.deb_dependencies }}
+
+    - name: prepare
+      run:  ./.ci/linux-prepare.sh
+
+    - name: build
+      run:  ./.ci/linux-build.sh
+
+    - name: upload deb packages
+      uses: actions/upload-artifact@v2
+      with:
+        name: deb-packages
+        path: '/home/runner/work/ovn/*.deb'