ci: add Fedora 35 container in GHA

Message ID 20211116123102.19237-1-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series ci: add Fedora 35 container in GHA |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

David Marchand Nov. 16, 2021, 12:31 p.m. UTC
  Build DPDK with Fedora 35 containers.
Differences with the Ubuntu GHA vm images:
- tasks are run as root in containers, no need for sudo,
- compiler must be explicitly installed: clang is not in container images,
- GHA artifacts can't contain a ':' in their name, and must be filtered,

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .ci/linux-build.sh          |  3 ++
 .ci/linux-setup.sh          |  3 ++
 .github/workflows/build.yml | 67 +++++++++++++++++++++++++++++++++++--
 3 files changed, 71 insertions(+), 2 deletions(-)
  

Comments

Aaron Conole Nov. 16, 2021, 2:44 p.m. UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> Build DPDK with Fedora 35 containers.
> Differences with the Ubuntu GHA vm images:
> - tasks are run as root in containers, no need for sudo,
> - compiler must be explicitly installed: clang is not in container images,
> - GHA artifacts can't contain a ':' in their name, and must be filtered,
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

This is awesome!

Acked-by: Aaron Conole <aconole@redhat.com>
  
David Marchand Nov. 17, 2021, 5:29 p.m. UTC | #2
On Tue, Nov 16, 2021 at 3:44 PM Aaron Conole <aconole@redhat.com> wrote:
> > Build DPDK with Fedora 35 containers.
> > Differences with the Ubuntu GHA vm images:
> > - tasks are run as root in containers, no need for sudo,
> > - compiler must be explicitly installed: clang is not in container images,
> > - GHA artifacts can't contain a ':' in their name, and must be filtered,
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Aaron Conole <aconole@redhat.com>

Unfortunately, while testing it a bit more (having it in my tree), I
got some random failures when pulling container images.
I suspect docker limits image pulls... but I am not sure yet.
I'll have to investigate this.


--
David Marchand
  
Aaron Conole Nov. 18, 2021, 2:17 p.m. UTC | #3
David Marchand <david.marchand@redhat.com> writes:

> On Tue, Nov 16, 2021 at 3:44 PM Aaron Conole <aconole@redhat.com> wrote:
>> > Build DPDK with Fedora 35 containers.
>> > Differences with the Ubuntu GHA vm images:
>> > - tasks are run as root in containers, no need for sudo,
>> > - compiler must be explicitly installed: clang is not in container images,
>> > - GHA artifacts can't contain a ':' in their name, and must be filtered,
>> >
>> > Signed-off-by: David Marchand <david.marchand@redhat.com>
>> Acked-by: Aaron Conole <aconole@redhat.com>
>
> Unfortunately, while testing it a bit more (having it in my tree), I
> got some random failures when pulling container images.
> I suspect docker limits image pulls... but I am not sure yet.
> I'll have to investigate this.

I do see that there were warnings even with the github robot's run - but
those builds eventually went through.  I guess if it isn't stable, it
makes sense to not deploy.

One alternative is to create a separate "workflow" for github action
that can be called "fedora" and that will be recorded differently by the
robot and then if there's a failure at least it will be a different
"test."  This probably isn't preferable, though - since it creates
another test in the UI.

>
> --
> David Marchand
  

Patch

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index ef0bd099be..e34a74ab64 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -1,5 +1,8 @@ 
 #!/bin/sh -xe
 
+# Builds are run as root in containers, no need for sudo
+[ "$(id -u)" != '0' ] || alias sudo=
+
 on_error() {
     if [ $? = 0 ]; then
         exit
diff --git a/.ci/linux-setup.sh b/.ci/linux-setup.sh
index ca35b4b38d..f5ef6b1b98 100755
--- a/.ci/linux-setup.sh
+++ b/.ci/linux-setup.sh
@@ -1,5 +1,8 @@ 
 #!/bin/sh -xe
 
+# Builds are run as root in containers, no need for sudo
+[ "$(id -u)" != '0' ] || alias sudo=
+
 # need to install as 'root' since some of the unit tests won't run without it
 sudo python3 -m pip install --upgrade 'meson==0.49.2'
 
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4151cafee7..8429ffb721 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,7 +10,7 @@  defaults:
     shell: bash --noprofile --norc -exo pipefail {0}
 
 jobs:
-  build:
+  ubuntu-vms:
     name: ${{ join(matrix.config.*, '-') }}
     runs-on: ${{ matrix.config.os }}
     env:
@@ -140,7 +140,70 @@  jobs:
       with:
         name: meson-logs-${{ join(matrix.config.*, '-') }}
         path: |
+          build/.ninja_log
+          build/gdb.log
+          build/meson-logs/meson-log.txt
           build/meson-logs/testlog.txt
+
+  rpm-containers:
+    name: ${{ join(matrix.config.*, '-') }}
+    runs-on: ubuntu-latest
+    container:
+      image: ${{ matrix.config.image }}
+    env:
+      CC: ccache ${{ matrix.config.compiler }}
+      DEF_LIB: ${{ matrix.config.library }}
+
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - image: fedora:35
+            compiler: gcc
+            library: static
+          - image: fedora:35
+            compiler: gcc
+            library: shared
+          - image: fedora:35
+            compiler: clang
+            library: static
+          - image: fedora:35
+            compiler: clang
+            library: shared
+
+    steps:
+    - name: Checkout sources
+      uses: actions/checkout@v2
+    - name: Generate various keys
+      id: get_keys
+      run: |
+        echo -n '::set-output name=ccache::'
+        echo 'ccache-${{ matrix.config.image }}-${{ matrix.config.compiler }}-'$(date -u +%Y-w%W)
+        echo -n '::set-output name=logs::'
+        echo 'meson-logs-${{ join(matrix.config.*, '-') }}' | tr -d ':'
+    - name: Retrieve ccache cache
+      uses: actions/cache@v2
+      with:
+        path: ~/.ccache
+        key: ${{ steps.get_keys.outputs.ccache }}-${{ github.ref }}
+        restore-keys: |
+          ${{ steps.get_keys.outputs.ccache }}-refs/heads/main
+    - name: Update
+      run: dnf update -y || true
+    - name: Install packages
+      run: dnf install -y ccache numactl-devel python3-setuptools
+        python3-wheel python3-pip python3-pyelftools ninja-build
+        libatomic libbpf-devel libfdt-devel libpcap-devel openssl-devel
+        rdma-core-devel zlib-devel ${{ matrix.config.compiler }}
+    - name: Run setup
+      run: .ci/linux-setup.sh
+    - name: Build
+      run: .ci/linux-build.sh
+    - name: Upload logs on failure
+      if: failure()
+      uses: actions/upload-artifact@v2
+      with:
+        name: ${{ steps.get_keys.outputs.logs }}
+        path: |
           build/.ninja_log
           build/meson-logs/meson-log.txt
-          build/gdb.log