]> git.infradead.org Git - users/sagi/libnvme.git/commitdiff
build: use container for coverage build
authorDaniel Wagner <dwagner@suse.de>
Thu, 31 Aug 2023 09:40:17 +0000 (11:40 +0200)
committerDaniel Wagner <wagi@monom.org>
Thu, 31 Aug 2023 09:42:43 +0000 (11:42 +0200)
The coverage build also fails due missing dependency in
install step. Let's use a prebuild container here as well.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
.github/workflows/build.yml
.github/workflows/coverage.yml
.github/workflows/release-python.yml
scripts/build.sh

index 40b95e2f58660b9b9a7a47bce6e5b7fdd3152ced..3805f85447e8ca616cd6cd09d28ee04d560716ce 100644 (file)
@@ -17,7 +17,7 @@ jobs:
         compiler: [gcc, clang]
         buildtype: [debug, release]
     container:
-      image: ghcr.io/igaw/linux-nvme/debian:0.34
+      image: ghcr.io/igaw/linux-nvme/debian:0.35
     steps:
       - uses: actions/checkout@v3
       - uses: actions/setup-python@v4
@@ -49,7 +49,7 @@ jobs:
       - name: compile and run unit tests
         uses: mosteo-actions/docker-run@v1
         with:
-          image: ghcr.io/igaw/linux-nvme/ubuntu-cross-${{ matrix.arch }}:0.34
+          image: ghcr.io/igaw/linux-nvme/ubuntu-cross-${{ matrix.arch }}:0.35
           guest-dir: /build
           host-dir: ${{ github.workspace }}
           command: |
@@ -68,7 +68,7 @@ jobs:
     name: libdbus
     runs-on: ubuntu-latest
     container:
-      image: ghcr.io/igaw/linux-nvme/debian:0.34
+      image: ghcr.io/igaw/linux-nvme/debian:0.35
     steps:
       - uses: actions/checkout@v3
       - uses: actions/setup-python@v4
@@ -89,7 +89,7 @@ jobs:
     name: fallback shared libraries
     runs-on: ubuntu-latest
     container:
-      image: ghcr.io/igaw/linux-nvme/debian:0.34
+      image: ghcr.io/igaw/linux-nvme/debian:0.35
     if: github.ref == 'refs/heads/master'
     steps:
       - uses: actions/checkout@v3
@@ -110,7 +110,7 @@ jobs:
     name: muon minimal static
     runs-on: ubuntu-latest
     container:
-      image: ghcr.io/igaw/linux-nvme/debian:0.34
+      image: ghcr.io/igaw/linux-nvme/debian:0.35
     steps:
       - uses: actions/checkout@v3
       - name: build
index e26ffab89efff2fe9391757f26c4e8bc44fa5d9f..d7166e8ee572ac7dbc01141aeccaf3736694827e 100644 (file)
@@ -9,30 +9,12 @@ jobs:
   code-coverage:
     name: code coverage
     runs-on: ubuntu-latest
+    container:
+      image: ghcr.io/igaw/linux-nvme/debian.python:0.35
     steps:
-      - name: install libraries
-        run: sudo apt-get install libjson-c-dev libdbus-1-dev lcov
-      - uses: actions/checkout@v3
-      - uses: actions/setup-python@v4
-        with:
-          python-version: '3.x'
-      - uses: BSFishy/meson-build@v1.0.3
-        with:
-          # Can't use 'coverage' here, see
-          # https://github.com/BSFishy/meson-build/issues/4
-          action: test
-          options: --verbose
-          setup-options: >
-            --werror
-            --buildtype=release
-            --wrap-mode=nofallback
-            -Dlibdbus=enabled
-            -Db_coverage=true
-          meson-version: 0.61.2
-      - name: Generate Coverage Report
-        # Can't use meson here, see
-        # https://github.com/mesonbuild/meson/issues/7895
-        run: ninja -C build coverage --verbose
+      - name: build
+        run: |
+          scripts/build.sh coverage
       - uses: codecov/codecov-action@v3
         with:
           fail_ci_if_error: false
index d9051c96fd6fd61c3a36bd0803df571f86d28bcd..cce3c71f0bf9456057bcc1fc2e65b824c440343e 100644 (file)
@@ -16,7 +16,7 @@ jobs:
     name: Build source distribution
     runs-on: ubuntu-latest
     container:
-      image: ghcr.io/igaw/linux-nvme/debian.python:0.34
+      image: ghcr.io/igaw/linux-nvme/debian.python:0.35
     steps:
       - uses: actions/checkout@v3
 
index 82d271bf927adea8199da6402d1f456626938c54..8e5cf53fac8d8b715691016df9117289da56f6ae 100755 (executable)
@@ -19,6 +19,7 @@ usage() {
     echo "  fallback            download all dependencies"
     echo "                      and build them as shared libaries"
     echo "  cross               use cross toolchain to build"
+    echo "  coverage            build coverage report"
     echo ""
     echo "configs with muon:"
     echo "  [default]           minimal static build"
@@ -58,6 +59,8 @@ cd "$(git rev-parse --show-toplevel)" || exit 1
 
 BUILDDIR="$(pwd)/.build-ci"
 
+fn_exists() { declare -F "$1" > /dev/null; }
+
 config_meson_default() {
     CC="${CC}" "${MESON}" setup                 \
         --werror                                \
@@ -95,16 +98,34 @@ config_meson_cross() {
         "${BUILDDIR}"
 }
 
+config_meson_coverage() {
+    CC="${CC}" "${MESON}" setup                 \
+        --werror                                \
+        --buildtype="${BUILDTYPE}"              \
+        --wrap-mode=nofallback                  \
+        -Dlibdbus=enabled                       \
+        -Db_coverage=true                       \
+        "${BUILDDIR}"
+}
+
 build_meson() {
     "${MESON}" compile                          \
         -C "${BUILDDIR}"
 }
 
+build_meson_coverage() {
+    ninja -C "${BUILDDIR}" coverage --verbose
+}
+
 test_meson() {
     "${MESON}" test                             \
         -C "${BUILDDIR}"
 }
 
+test_meson_covarage() {
+    true;
+}
+
 tools_build_samurai() {
     mkdir -p "${BUILDDIR}"/build-tools
     git clone --depth 1 https://github.com/michaelforney/samurai.git \
@@ -178,5 +199,5 @@ if [[ "${BUILDTOOL}" == "muon" ]]; then
 fi
 
 config_"${BUILDTOOL}"_"${CONFIG}"
-build_"${BUILDTOOL}"
-test_"${BUILDTOOL}"
+fn_exists "build_${BUILDTOOL}_${CONFIG}" && "build_${BUILDTOOL}_${CONFIG}" || build_"${BUILDTOOL}"
+fn_exists "test_${BUILDTOOL}_${CONFIG}" && "test_${BUILDTOOL}_${CONFIG}" || test_"${BUILDTOOL}"