diff mbox series

[ovs-dev] CI: Add github actions workflow.

Message ID 20201125064044.2879011-1-numans@ovn.org
State Changes Requested
Headers show
Series [ovs-dev] CI: Add github actions workflow. | expand

Commit Message

Numan Siddique Nov. 25, 2020, 6:40 a.m. UTC
From: Numan Siddique <numans@ovn.org>

This patch adds basic github actions to build and run OVN tests.
The test matrix is a slightly reduced version of current travis matrix.
We don't need to run OVN with multiple kernel versions.

This patch also removes the .travis.yml file as there is little value
in running the same tests in travis CI, given that travis-ci.org will
be turned into read-only mode. More information on this can be found
here [1].

We can further enhance the github actions to run ovn-kubernetes
end-to-end tests.

Thanks to Ilya, much of the github actions code is taken from Ilya's OVS
github action patch [2].

[1] - https://mail.openvswitch.org/pipermail/ovs-dev/2020-November/377773.html
[2] - https://patchwork.ozlabs.org/project/openvswitch/patch/20201124155443.382929-1-i.maximets@ovn.org/
Co-authored-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
Here is how it looks like:
  https://github.com/numansiddique/ovn/runs/1451852342

Antonio Ojea <aojea@redhat.com> has submitted a PR - https://github.com/ovn-org/ovn/pull/61 
to run ovn-k8s end-to-end tests using github actions a while back. That PR
needs some polishing. I will be submitting that for review once it is
ready.

 {.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/test.yml        | 80 +++++++++++++++++++++++++++++++
 .travis.yml                       | 47 ------------------
 Makefile.am                       | 10 ++--
 7 files changed, 85 insertions(+), 52 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/test.yml
 delete mode 100644 .travis.yml

Comments

Ilya Maximets Nov. 25, 2020, 10:52 a.m. UTC | #1
On 11/25/20 7:40 AM, numans@ovn.org wrote:
> From: Numan Siddique <numans@ovn.org>
> 
> This patch adds basic github actions to build and run OVN tests.
> The test matrix is a slightly reduced version of current travis matrix.
> We don't need to run OVN with multiple kernel versions.
> 
> This patch also removes the .travis.yml file as there is little value
> in running the same tests in travis CI, given that travis-ci.org will
> be turned into read-only mode. More information on this can be found
> here [1].
> 
> We can further enhance the github actions to run ovn-kubernetes
> end-to-end tests.
> 
> Thanks to Ilya, much of the github actions code is taken from Ilya's OVS
> github action patch [2].
> 
> [1] - https://mail.openvswitch.org/pipermail/ovs-dev/2020-November/377773.html
> [2] - https://patchwork.ozlabs.org/project/openvswitch/patch/20201124155443.382929-1-i.maximets@ovn.org/
> Co-authored-by: Ilya Maximets <i.maximets@ovn.org>
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> Signed-off-by: Numan Siddique <numans@ovn.org>
> ---
> Here is how it looks like:
>   https://github.com/numansiddique/ovn/runs/1451852342
> 
> Antonio Ojea <aojea@redhat.com> has submitted a PR - https://github.com/ovn-org/ovn/pull/61 
> to run ovn-k8s end-to-end tests using github actions a while back. That PR
> needs some polishing. I will be submitting that for review once it is
> ready.
> 
>  {.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/test.yml        | 80 +++++++++++++++++++++++++++++++
>  .travis.yml                       | 47 ------------------
>  Makefile.am                       | 10 ++--
>  7 files changed, 85 insertions(+), 52 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/test.yml
>  delete mode 100644 .travis.yml
> 
> 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/test.yml b/.github/workflows/test.yml
> new file mode 100644
> index 0000000000..e319622e1e
> --- /dev/null
> +++ b/.github/workflows/test.yml
> @@ -0,0 +1,80 @@
> +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 libpcap-dev  \
> +        python3-openssl python3-pip python3-sphinx              \
> +        selinux-policy-dev
> +      CC:          ${{ matrix.compiler }}
> +      LIBS:        ${{ matrix.libs }}
> +      M32:         ${{ matrix.m32 }}

OVN uses BUILD_ENV environment variable to test 32-bit build instead.
And you will likely need to add gcc-multilib to dependencies.

So, it should be:
      BUILD_ENV:       ${{ matrix.build_env }}

> +      OPTS:        ${{ matrix.opts }}
> +      TESTSUITE:   ${{ matrix.testsuite }}
> +
> +    name: linux ${{ join(matrix.*, ' ') }}
> +    runs-on: ubuntu-latest

I'm starting to think that we should specify ubuntu-18.04 specifically.
ubuntu-20.04 will become ubuntu-latest soon and this might cause ci
failures, e.g. ubuntu-20.04 doesn't have libjemalloc1, instead it has
libjemalloc2.

> +
> +    strategy:
> +      fail-fast: false
> +      matrix:
> +        include:
> +          - compiler:     gcc
> +            opts:         --disable-ssl
> +          - compiler:     clang
> +            opts:         --disable-ssl
> +
> +          - compiler:     gcc
> +            testsuite:    test
> +          - compiler:     clang
> +            testsuite:    test
> +
> +          - compiler:     gcc
> +            testsuite:    test
> +            libs:         -ljemalloc
> +          - compiler:     clang
> +            testsuite:    test
> +            libs:         -ljemalloc
> +
> +          - compiler:     gcc
> +            m32:          m32

This should be '-m32' since this goes as a compiler flag directly.
e.g.:
         build_env:          -m32

> +            opts:         --disable-ssl
> +
> +    steps:
> +    - name: checkout
> +      uses: actions/checkout@v2
> +
> +    - name: install common dependencies
> +      if:   matrix.dependencies == ''

This 'if' is not needed.  There is no matrix entry with special 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
> +
> +  build-osx:
> +    env:
> +      CC:    clang
> +      OPTS:  --disable-ssl
> +
> +    name:    osx clang --disable-ssl
> +    runs-on: macos-latest
> +
> +    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
> diff --git a/.travis.yml b/.travis.yml
> deleted file mode 100644
> index cd853fddd9..0000000000
> --- a/.travis.yml
> +++ /dev/null
> @@ -1,47 +0,0 @@
> -language: c
> -compiler:
> -  - gcc
> -  - clang
> -
> -os:
> -  - linux
> -
> -addons:
> -  apt:
> -    packages:
> -      - bc
> -      - gcc-multilib
> -      - libssl-dev
> -      - llvm-dev
> -      - libjemalloc1
> -      - libjemalloc-dev
> -      - libnuma-dev
> -      - python-sphinx
> -      - libelf-dev
> -      - selinux-policy-dev
> -      - libunbound-dev
> -      - libunbound-dev:i386
> -
> -before_install: ./.travis/${TRAVIS_OS_NAME}-prepare.sh
> -
> -before_script: export PATH=$PATH:$HOME/bin
> -
> -env:
> -  - OPTS="--disable-ssl"
> -  - TESTSUITE=1 KERNEL=4.18.20
> -  - TESTSUITE=1 OPTS="--enable-shared"
> -  - BUILD_ENV="-m32" OPTS="--disable-ssl"
> -  - TESTSUITE=1 LIBS=-ljemalloc
> -
> -matrix:
> -  include:
> -    - os: osx
> -      compiler: clang
> -      env: OPTS="--disable-ssl"
> -
> -script: ./.travis/${TRAVIS_OS_NAME}-build.sh $OPTS
> -
> -notifications:
> -  email:
> -    recipients:
> -      - ovs-build@openvswitch.org
> diff --git a/Makefile.am b/Makefile.am
> index 221ca61be7..7ce3d27e46 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -84,11 +84,11 @@ EXTRA_DIST = \
>  	README.rst \
>  	NOTICE \
>  	.cirrus.yml \
> -	.travis.yml \
> -	.travis/linux-build.sh \
> -	.travis/linux-prepare.sh \
> -	.travis/osx-build.sh \
> -	.travis/osx-prepare.sh \
> +	.ci/linux-build.sh \
> +	.ci/linux-prepare.sh \
> +	.ci/osx-build.sh \
> +	.ci/osx-prepare.sh \
> +	.github/workflows/test.yml \
>  	boot.sh \
>  	$(MAN_FRAGMENTS) \
>  	$(MAN_ROOTS) \
>
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/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000000..e319622e1e
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,80 @@ 
+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 libpcap-dev  \
+        python3-openssl python3-pip python3-sphinx              \
+        selinux-policy-dev
+      CC:          ${{ matrix.compiler }}
+      LIBS:        ${{ matrix.libs }}
+      M32:         ${{ matrix.m32 }}
+      OPTS:        ${{ matrix.opts }}
+      TESTSUITE:   ${{ matrix.testsuite }}
+
+    name: linux ${{ join(matrix.*, ' ') }}
+    runs-on: ubuntu-latest
+
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - compiler:     gcc
+            opts:         --disable-ssl
+          - compiler:     clang
+            opts:         --disable-ssl
+
+          - compiler:     gcc
+            testsuite:    test
+          - compiler:     clang
+            testsuite:    test
+
+          - compiler:     gcc
+            testsuite:    test
+            libs:         -ljemalloc
+          - compiler:     clang
+            testsuite:    test
+            libs:         -ljemalloc
+
+          - compiler:     gcc
+            m32:          m32
+            opts:         --disable-ssl
+
+    steps:
+    - name: checkout
+      uses: actions/checkout@v2
+
+    - name: install common dependencies
+      if:   matrix.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
+
+  build-osx:
+    env:
+      CC:    clang
+      OPTS:  --disable-ssl
+
+    name:    osx clang --disable-ssl
+    runs-on: macos-latest
+
+    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
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index cd853fddd9..0000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,47 +0,0 @@ 
-language: c
-compiler:
-  - gcc
-  - clang
-
-os:
-  - linux
-
-addons:
-  apt:
-    packages:
-      - bc
-      - gcc-multilib
-      - libssl-dev
-      - llvm-dev
-      - libjemalloc1
-      - libjemalloc-dev
-      - libnuma-dev
-      - python-sphinx
-      - libelf-dev
-      - selinux-policy-dev
-      - libunbound-dev
-      - libunbound-dev:i386
-
-before_install: ./.travis/${TRAVIS_OS_NAME}-prepare.sh
-
-before_script: export PATH=$PATH:$HOME/bin
-
-env:
-  - OPTS="--disable-ssl"
-  - TESTSUITE=1 KERNEL=4.18.20
-  - TESTSUITE=1 OPTS="--enable-shared"
-  - BUILD_ENV="-m32" OPTS="--disable-ssl"
-  - TESTSUITE=1 LIBS=-ljemalloc
-
-matrix:
-  include:
-    - os: osx
-      compiler: clang
-      env: OPTS="--disable-ssl"
-
-script: ./.travis/${TRAVIS_OS_NAME}-build.sh $OPTS
-
-notifications:
-  email:
-    recipients:
-      - ovs-build@openvswitch.org
diff --git a/Makefile.am b/Makefile.am
index 221ca61be7..7ce3d27e46 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,11 +84,11 @@  EXTRA_DIST = \
 	README.rst \
 	NOTICE \
 	.cirrus.yml \
-	.travis.yml \
-	.travis/linux-build.sh \
-	.travis/linux-prepare.sh \
-	.travis/osx-build.sh \
-	.travis/osx-prepare.sh \
+	.ci/linux-build.sh \
+	.ci/linux-prepare.sh \
+	.ci/osx-build.sh \
+	.ci/osx-prepare.sh \
+	.github/workflows/test.yml \
 	boot.sh \
 	$(MAN_FRAGMENTS) \
 	$(MAN_ROOTS) \