]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
build: use prebuild containers for builds
authorDaniel Wagner <dwagner@suse.de>
Thu, 31 Aug 2023 10:47:22 +0000 (12:47 +0200)
committerDaniel Wagner <wagi@monom.org>
Thu, 31 Aug 2023 11:31:54 +0000 (13:31 +0200)
The builds keep failing because the install step fails. Use prebuild
containers which contain all the dependencies.

While at it, also add a coverage build.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
.github/workflows/appimage.yml
.github/workflows/build.yml
.github/workflows/coverage.yml [new file with mode: 0644]
scripts/build.sh

index f7b7ae0831e63651277056606329dc1cc5b946a7..b711ef7e56dac6c62cffa2011c081199f92951ab 100644 (file)
@@ -13,24 +13,14 @@ jobs:
   build-appimage:
     name: build AppImage
     runs-on: ubuntu-latest
+    container:
+      image: ghcr.io/igaw/linux-nvme/debian:0.36
     steps:
-      - uses: actions/checkout@v3
-      - name: install dependencies
-        run: sudo apt-get install libjson-c-dev libssl-dev libdbus-1-dev libhugetlbfs-dev
-      - uses: actions/setup-python@v4
-        with:
-          python-version: '3.x'
-      - uses: BSFishy/meson-build@v1.0.3
-        with:
-          setup-options: >
-            --werror
-            --buildtype=release
-            --prefix=/usr
-            --force-fallback-for=libnvme
-            -Dlibnvme:werror=false
-          action: install
-          meson-version: 0.61.2
-      - name: build AppImage
+     - uses: actions/checkout@v3
+     - name: build
+        run: |
+          scripts/build.sh appimage
+     - name: build AppImage
         uses: AppImageCrafters/build-appimage@v1.3
         with:
           recipe: .github/AppImageBuilder.yml
index e3e2fd4ebddc1991ec44d4cd48e69a5cf939465a..1c687c9cd031c158b5b75b83155f5d3c27bcb47a 100644 (file)
@@ -17,12 +17,9 @@ jobs:
         compiler: [gcc, clang]
         buildtype: [debug, release]
     container:
-      image: ghcr.io/igaw/linux-nvme/debian:0.30
+      image: ghcr.io/igaw/linux-nvme/debian.python:0.36
     steps:
       - uses: actions/checkout@v3
-      - uses: actions/setup-python@v4
-        with:
-          python-version: '3.x'
       - name: build
         run: |
           scripts/build.sh -b ${{ matrix.buildtype }} -c ${{ matrix.compiler }}
@@ -40,33 +37,22 @@ jobs:
       matrix:
         include:
           - arch: armhf
-            port: armhf
-            compiler: gcc-arm-linux-gnueabihf
-            packages:
           - arch: s390x
-            port: s390x
-            compiler: gcc-s390x-linux-gnu
-            packages: libgcc-s1:s390x
           - arch: ppc64le
-            port: ppc64el
-            compiler: gcc-powerpc64le-linux-gnu
-            packges:
     steps:
       - uses: actions/checkout@v3
-      - name: set up arm architecture
-        run: |
-          export release=$(lsb_release -c -s)
-          sudo dpkg --add-architecture ${{ matrix.port }}
-          sudo sed -i -e 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list
-          sudo dd of=/etc/apt/sources.list.d/${{ matrix.arch }}.list <<EOF
-          deb [arch=${{ matrix.port }}] http://ports.ubuntu.com/ $release main universe restricted"
-          deb [arch=${{ matrix.port }}] http://ports.ubuntu.com/ $release-updates main universe restricted"
-          EOF
-          sudo apt update
-          sudo apt install -y meson pkg-config qemu-user-static ${{ matrix.compiler}} libjson-c-dev:${{ matrix.port }} ${{ matrix.packages }}
-      - name: build
-        run: |
-          scripts/build.sh -b release -c gcc -t ${{ matrix.arch }} cross
+      - name: enable foreign arch
+        uses: dbhi/qus/action@main
+      - name: compile and run unit tests
+        uses: mosteo-actions/docker-run@v1
+        with:
+          image: ghcr.io/igaw/linux-nvme/ubuntu-cross-${{ matrix.arch }}:0.36
+          guest-dir: /build
+          host-dir: ${{ github.workspace }}
+          command: |
+            scripts/build.sh -b release -c gcc -t ${{ matrix.arch }} cross
+          params: "--platform linux/amd64"
+          pull-params: "--platform linux/amd64"
       - uses: actions/upload-artifact@v3
         name: upload logs
         if: failure()
@@ -79,13 +65,10 @@ jobs:
     name: fallback shared libraries
     runs-on: ubuntu-latest
     container:
-      image: ghcr.io/igaw/linux-nvme/debian:0.30
+      image: ghcr.io/igaw/linux-nvme/debian:0.36
     if: github.ref == 'refs/heads/master'
     steps:
       - uses: actions/checkout@v3
-      - uses: actions/setup-python@v4
-        with:
-          python-version: '3.x'
       - name: build
         run: |
           scripts/build.sh -b release -c gcc fallback
@@ -100,7 +83,7 @@ jobs:
     name: muon minimal static
     runs-on: ubuntu-latest
     container:
-      image: ghcr.io/igaw/linux-nvme/debian:0.30
+      image: ghcr.io/igaw/linux-nvme/debian:0.36
     steps:
       - uses: actions/checkout@v3
       - name: build
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644 (file)
index 0000000..4a2b855
--- /dev/null
@@ -0,0 +1,21 @@
+---
+name: coverage
+
+on:
+  push:
+    branches: [master]
+
+jobs:
+  code-coverage:
+    name: code coverage
+    runs-on: ubuntu-latest
+    container:
+      image: ghcr.io/igaw/linux-nvme/debian.python:0.36
+    steps:
+      - uses: actions/checkout@v3
+      - name: build
+        run: |
+          scripts/build.sh coverage
+      - uses: codecov/codecov-action@v3
+        with:
+          fail_ci_if_error: false
index 94c62b865acbcdc7cacdef303ff16637ee89df49..fd491653c9560fec0dd8cf8acd2114aacd8b661c 100755 (executable)
@@ -18,6 +18,8 @@ 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 "  appimage            build AppImage target"
     echo ""
     echo "configs with muon:"
     echo "  [default]           minimal static build"
@@ -57,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                                \
@@ -89,16 +93,49 @@ config_meson_cross() {
         "${BUILDDIR}"
 }
 
+config_meson_coverage() {
+    CC="${CC}" "${MESON}" setup                 \
+        --werror                                \
+        --buildtype="${BUILDTYPE}"              \
+        --force-fallback-for=libnvme            \
+        -Dlibnvme:werror=false                  \
+        -Db_coverage=true                       \
+        "${BUILDDIR}"
+}
+
+config_meson_appimage() {
+    CC="${CC}" "${MESON}" setup                 \
+        --werror                                \
+        --buildtype="${BUILDTYPE}"              \
+        --force-fallback-for=libnvme            \
+        --prefix=/usr                           \
+        -Dlibnvme:werror=false                  \
+        "${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;
+}
+
+install_meson_appimage() {
+    "${MESON}" install                             \
+        -C "${BUILDDIR}"
+}
+
 tools_build_samurai() {
     mkdir -p "${BUILDDIR}"/build-tools
     git clone --depth 1 https://github.com/michaelforney/samurai.git \
@@ -173,5 +210,6 @@ 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}"
+fn_exists "install_${BUILDTOOL}_${CONFIG}" && "install_${BUILDTOOL}_${CONFIG}" || true;