diff mbox series

[ovs-dev,branch-2.9,1/2] github: Add GitHub Actions workflow.

Message ID 20201126124922.654805-2-i.maximets@ovn.org
State Accepted
Headers show
Series GitHub Actions integration and Travis CI update. | expand

Commit Message

Ilya Maximets Nov. 26, 2020, 12:49 p.m. UTC
This is an initial version of GitHub Actions support.  It mostly
mimics our current Travis CI build matrix with slight differences.

.travis folder renamed to .ci to highlight that it used not only for
Travis CI.  Travis CI support will be completely removed soon.

What happened to Travis CI:
https://mail.openvswitch.org/pipermail/ovs-dev/2020-November/377773.html

Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 {.travis => .ci}/linux-build.sh               |   0
 {.travis => .ci}/linux-prepare.sh             |   0
 {.travis => .ci}/osx-build.sh                 |   0
 {.travis => .ci}/osx-prepare.sh               |   0
 .github/workflows/build-and-test.yml          | 141 ++++++++++++++++++
 .travis.yml                                   |   4 +-
 .../contributing/submitting-patches.rst       |   9 +-
 Makefile.am                                   |   9 +-
 README.rst                                    |   2 +
 9 files changed, 154 insertions(+), 11 deletions(-)
 rename {.travis => .ci}/linux-build.sh (100%)
 rename {.travis => .ci}/linux-prepare.sh (100%)
 rename {.travis => .ci}/osx-build.sh (100%)
 rename {.travis => .ci}/osx-prepare.sh (100%)
 create mode 100644 .github/workflows/build-and-test.yml

Comments

0-day Robot Nov. 26, 2020, 2:02 p.m. UTC | #1
Bleep bloop.  Greetings Ilya Maximets, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


build:
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I.    -I ./include -I ./include -I ./lib -I ./lib    -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror   -g -O2 -MT lib/odp-execute.lo -MD -MP -MF $depbase.Tpo -c -o lib/odp-execute.lo lib/odp-execute.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include -I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror -g -O2 -MT lib/odp-execute.lo -MD -MP -MF lib/.deps/odp-execute.Tpo -c lib/odp-execute.c -o lib/odp-execute.o
depbase=`echo lib/odp-util.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I.    -I ./include -I ./include -I ./lib -I ./lib    -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror   -g -O2 -MT lib/odp-util.lo -MD -MP -MF $depbase.Tpo -c -o lib/odp-util.lo lib/odp-util.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include -I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror -g -O2 -MT lib/odp-util.lo -MD -MP -MF lib/.deps/odp-util.Tpo -c lib/odp-util.c -o lib/odp-util.o
lib/odp-util.c: In function 'parse_odp_key_mask_attr':
lib/odp-util.c:4908:30: error: 'mask_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             nl_msg_end_nested(mask, mask_offset);                             \
                              ^
lib/odp-util.c:4893:28: note: 'mask_offset' was declared here
         size_t key_offset, mask_offset;                    \
                            ^
lib/odp-util.c:5171:5: note: in expansion of macro 'SCAN_BEGIN_NESTED'
     SCAN_BEGIN_NESTED("tunnel(", OVS_KEY_ATTR_TUNNEL) {
     ^
lib/odp-util.c: At top level:
cc1: error: unrecognized command line option "-Wno-null-pointer-arithmetic" [-Werror]
cc1: all warnings being treated as errors
make[2]: *** [lib/odp-util.lo] Error 1
make[2]: Leaving directory `/var/lib/jenkins/jobs/0day_robot_upstream_build_from_pw/workspace'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/lib/jenkins/jobs/0day_robot_upstream_build_from_pw/workspace'
make: *** [all] Error 2


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Ilya Maximets Nov. 26, 2020, 2:25 p.m. UTC | #2
On 11/26/20 3:02 PM, 0-day Robot wrote:
> Bleep bloop.  Greetings Ilya Maximets, I am a robot and I have tried out your patch.
> Thanks for your contribution.
> 
> I encountered some error that I wasn't expecting.  See the details below.
> 
> 
> build:
> /bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I.    -I ./include -I ./include -I ./lib -I ./lib    -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror   -g -O2 -MT lib/odp-execute.lo -MD -MP -MF $depbase.Tpo -c -o lib/odp-execute.lo lib/odp-execute.c &&\
> mv -f $depbase.Tpo $depbase.Plo
> libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include -I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror -g -O2 -MT lib/odp-execute.lo -MD -MP -MF lib/.deps/odp-execute.Tpo -c lib/odp-execute.c -o lib/odp-execute.o
> depbase=`echo lib/odp-util.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
> /bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I.    -I ./include -I ./include -I ./lib -I ./lib    -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror   -g -O2 -MT lib/odp-util.lo -MD -MP -MF $depbase.Tpo -c -o lib/odp-util.lo lib/odp-util.c &&\
> mv -f $depbase.Tpo $depbase.Plo
> libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include -I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wno-null-pointer-arithmetic -Werror -Werror -g -O2 -MT lib/odp-util.lo -MD -MP -MF lib/.deps/odp-util.Tpo -c lib/odp-util.c -o lib/odp-util.o
> lib/odp-util.c: In function 'parse_odp_key_mask_attr':
> lib/odp-util.c:4908:30: error: 'mask_offset' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>              nl_msg_end_nested(mask, mask_offset);                             \
>                               ^
> lib/odp-util.c:4893:28: note: 'mask_offset' was declared here
>          size_t key_offset, mask_offset;                    \
>                             ^
> lib/odp-util.c:5171:5: note: in expansion of macro 'SCAN_BEGIN_NESTED'
>      SCAN_BEGIN_NESTED("tunnel(", OVS_KEY_ATTR_TUNNEL) {
>      ^

That is a false-positive fixed on later branches with commit:
c3013fd3fddb ("odp-util: Keep Address Sanitizer happy.")

Not sure if we need to backport it though.  Thoughts?

TBH, we have some issues on older branches with new compilers,
so maybe it make sense to just disable Werror for these branches
or use older compilers.  It's hard to maintain warning-free builds
for brand new shiny compilers on old branches in general.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/.travis/linux-build.sh b/.ci/linux-build.sh
similarity index 100%
rename from .travis/linux-build.sh
rename to .ci/linux-build.sh
diff --git a/.travis/linux-prepare.sh b/.ci/linux-prepare.sh
similarity index 100%
rename from .travis/linux-prepare.sh
rename to .ci/linux-prepare.sh
diff --git a/.travis/osx-build.sh b/.ci/osx-build.sh
similarity index 100%
rename from .travis/osx-build.sh
rename to .ci/osx-build.sh
diff --git a/.travis/osx-prepare.sh b/.ci/osx-prepare.sh
similarity index 100%
rename from .travis/osx-prepare.sh
rename to .ci/osx-prepare.sh
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
new file mode 100644
index 000000000..edc414430
--- /dev/null
+++ b/.github/workflows/build-and-test.yml
@@ -0,0 +1,141 @@ 
+name: Build and Test
+
+on: [push, pull_request]
+
+jobs:
+  build-linux:
+    env:
+      dependencies: |
+        automake libtool gcc bc libjemalloc1 libjemalloc-dev    \
+        libssl-dev llvm-dev libelf-dev libnuma-dev              \
+        python-sphinx gcc-multilib
+      CC:          ${{ matrix.compiler }}
+      DPDK:        ${{ matrix.dpdk }}
+      DPDK_SHARED: ${{ matrix.dpdk_shared }}
+      KERNEL:      ${{ matrix.kernel }}
+      LIBS:        ${{ matrix.libs }}
+      BUILD_ENV:   ${{ matrix.build_env }}
+      OPTS:        ${{ matrix.opts }}
+      TESTSUITE:   ${{ matrix.testsuite }}
+
+    name: linux ${{ join(matrix.*, ' ') }}
+    runs-on: ubuntu-16.04
+    timeout-minutes: 30
+
+    strategy:
+      fail-fast: false
+      matrix:
+        compiler:    [gcc, clang]
+        kernel:      ['4.15.3', '4.14.19', '4.9.149', '4.4.115',
+                      '4.1.49', '3.10.108']
+        opts:        ['']
+        testsuite:   ['']
+        dpdk:        ['']
+        dpdk_shared: ['']
+        build_env:   ['']
+        include:
+          - compiler:     gcc
+            opts:         --disable-ssl
+          - compiler:     clang
+            opts:         --disable-ssl
+
+          - compiler:     gcc
+            testsuite:    test
+            kernel:       3.16.54
+          - compiler:     clang
+            testsuite:    test
+            kernel:       3.16.54
+
+          - compiler:     gcc
+            testsuite:    test
+            opts:         --enable-shared
+          - compiler:     clang
+            testsuite:    test
+            opts:         --enable-shared
+
+          - compiler:     gcc
+            testsuite:    test
+            libs:         -ljemalloc
+          - compiler:     clang
+            testsuite:    test
+            libs:         -ljemalloc
+
+          - compiler:     gcc
+            dpdk:         dpdk
+            kernel:       3.16.54
+          - compiler:     clang
+            dpdk:         dpdk
+            kernel:       3.16.54
+
+          - compiler:     gcc
+            dpdk:         dpdk
+            kernel:       3.16.54
+            opts:         --enable-shared
+          - compiler:     clang
+            dpdk:         dpdk
+            kernel:       3.16.54
+            opts:         --enable-shared
+
+          - compiler:     gcc
+            build_env:    -m32
+            opts:         --disable-ssl
+
+    steps:
+    - name: checkout
+      uses: actions/checkout@v2
+
+    - name: install common dependencies
+      run:  sudo apt install -y ${{ env.dependencies }}
+
+    - name: prepare
+      run:  ./.ci/linux-prepare.sh
+
+    - name: build
+      run:  PATH="$PATH:$HOME/bin" ./.ci/linux-build.sh ${{ env.OPTS }}
+
+    - name: copy logs on failure
+      if: failure() || cancelled()
+      run: |
+        # upload-artifact@v2 throws exceptions if it tries to upload socket
+        # files and we could have some socket files in testsuite.dir.
+        # Also, upload-artifact@v2 doesn't work well enough with wildcards.
+        # So, we're just archiving everything here to avoid any issues.
+        mkdir logs
+        cp config.log ./logs/
+        cp -r ./*/_build/sub/tests/testsuite.* ./logs/ || true
+        tar -czvf logs.tgz logs/
+
+    - name: upload logs on failure
+      if: failure() || cancelled()
+      uses: actions/upload-artifact@v2
+      with:
+        name: logs-linux-${{ join(matrix.*, '-') }}
+        path: logs.tgz
+
+  build-osx:
+    env:
+      CC:    clang
+      OPTS:  --disable-ssl
+
+    name:    osx clang --disable-ssl
+    runs-on: macos-latest
+    timeout-minutes: 30
+
+    strategy:
+      fail-fast: false
+
+    steps:
+    - name: checkout
+      uses: actions/checkout@v2
+    - name: install dependencies
+      run:  brew install automake libtool
+    - name: prepare
+      run:  ./.ci/osx-prepare.sh
+    - name: build
+      run:  PATH="$PATH:$HOME/bin" ./.ci/osx-build.sh
+    - name: upload logs on failure
+      if: failure()
+      uses: actions/upload-artifact@v2
+      with:
+        name: logs-osx-clang---disable-ssl
+        path: config.log
diff --git a/.travis.yml b/.travis.yml
index 89f396006..6eba3ebfc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@  addons:
       - python-sphinx
       - libelf-dev
 
-before_install: ./.travis/${TRAVIS_OS_NAME}-prepare.sh
+before_install: ./.ci/${TRAVIS_OS_NAME}-prepare.sh
 
 before_script: export PATH=$PATH:$HOME/bin
 
@@ -44,7 +44,7 @@  matrix:
       compiler: clang
       env: OPTS="--disable-ssl"
 
-script: ./.travis/${TRAVIS_OS_NAME}-build.sh $OPTS
+script: ./.ci/${TRAVIS_OS_NAME}-build.sh $OPTS
 
 notifications:
   email:
diff --git a/Documentation/internals/contributing/submitting-patches.rst b/Documentation/internals/contributing/submitting-patches.rst
index eb7e651b8..0f57b6a9d 100644
--- a/Documentation/internals/contributing/submitting-patches.rst
+++ b/Documentation/internals/contributing/submitting-patches.rst
@@ -68,11 +68,10 @@  Testing is also important:
   feature.  A bug fix patch should preferably add a test that would
   fail if the bug recurs.
 
-If you are using GitHub, then you may utilize the travis-ci.org CI build system
-by linking your GitHub repository to it. This will run some of the above tests
-automatically when you push changes to your repository.  See the "Continuous
-Integration with Travis-CI" in :doc:`/topics/testing` for details on how to set
-it up.
+If you are using GitHub, then you may utilize the travis-ci.org and the GitHub
+Actions CI build systems.  They will run some of the above tests automatically
+when you push changes to your repository.  See the "Continuous Integration with
+Travis-CI" in :doc:`/topics/testing` for details on how to set it up.
 
 Email Subject
 -------------
diff --git a/Makefile.am b/Makefile.am
index 6d39d96cb..833640d53 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,11 +75,12 @@  EXTRA_DIST = \
 	MAINTAINERS.rst \
 	README.rst \
 	NOTICE \
+	.ci/linux-build.sh \
+	.ci/linux-prepare.sh \
+	.ci/osx-build.sh \
+	.ci/osx-prepare.sh \
+	.github/workflows/build-and-test.yml \
 	.travis.yml \
-	.travis/linux-build.sh \
-	.travis/linux-prepare.sh \
-	.travis/osx-build.sh \
-	.travis/osx-prepare.sh \
 	appveyor.yml \
 	boot.sh \
 	$(MAN_FRAGMENTS) \
diff --git a/README.rst b/README.rst
index d20ab2d45..9ce2646de 100644
--- a/README.rst
+++ b/README.rst
@@ -6,6 +6,8 @@ 
 Open vSwitch
 ============
 
+.. image:: https://github.com/openvswitch/ovs/workflows/Build%20and%20Test/badge.svg
+    :target: https://github.com/openvswitch/ovs/actions
 .. image:: https://travis-ci.org/openvswitch/ovs.png
     :target: https://travis-ci.org/openvswitch/ovs
 .. image:: https://ci.appveyor.com/api/projects/status/github/openvswitch/ovs?branch=master&svg=true&retina=true