From be9a409a87e61fd291e4bbc442cbcbf7a09849c3 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 29 Jul 2025 09:07:42 +0200 Subject: [PATCH] build: replace AppImage with static build binary The AppImage build was introduced to give users access to a test binary. Before the switch to meson, the static build was used for this. In the meantime we figured out how to build a static build with meson, so there is no need for the AppImage workflow. Start to add to the release versions of nvme the tag as postfix. Furthermore, upload the artifacts to github. Signed-off-by: Daniel Wagner Co-authored-by: Dennis Maisenbacher --- .github/AppImageBuilder.yml | 57 ---------------------- .github/workflows/appimage.yml | 62 ------------------------ .github/workflows/upload.yml | 86 ++++++++++++++++++++++++++++++++++ Makefile | 1 + README.md | 4 +- scripts/build.sh | 17 +------ 6 files changed, 90 insertions(+), 137 deletions(-) delete mode 100644 .github/AppImageBuilder.yml delete mode 100644 .github/workflows/appimage.yml create mode 100644 .github/workflows/upload.yml diff --git a/.github/AppImageBuilder.yml b/.github/AppImageBuilder.yml deleted file mode 100644 index cce46890c4..0000000000 --- a/.github/AppImageBuilder.yml +++ /dev/null @@ -1,57 +0,0 @@ -# appimage-builder recipe see https://appimage-builder.readthedocs.io for details -version: 1 -script: - # Ensure that the mksquashfs tool is installed (workaround for the AppImageCrafters/build-appimage GHA) - - which mksquashfs || apt install squashfs-tools - # fake icons - - mkdir -p AppDir/usr/share/icons/hicolor/64x64/apps - - touch AppDir/usr/share/icons/hicolor/64x64/apps/nvme-cli.png - -AppDir: - path: AppDir - app_info: - id: linux-nvme.nvme-cli - name: nvme-cli - version: latest - icon: nvme-cli - exec: usr/sbin/nvme - exec_args: $@ - apt: - arch: amd64 - allow_unauthenticated: true - sources: - - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse - key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C' - - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse - - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse - - sourceline: deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse - include: - - libjson-c5 - - libssl3 - files: - include: - - libcrypt.so.3 - - libdbus-1.so.3 - - libjson-c.so.5 - exclude: - - usr/share/man - - usr/share/doc - test: - fedora-30: - image: appimagecrafters/tests-env:fedora-30 - command: ./AppRun - debian-stable: - image: appimagecrafters/tests-env:debian-stable - command: ./AppRun - archlinux-latest: - image: appimagecrafters/tests-env:archlinux-latest - command: ./AppRun - centos-7: - image: appimagecrafters/tests-env:centos-7 - command: ./AppRun - ubuntu-xenial: - image: appimagecrafters/tests-env:ubuntu-xenial - command: ./AppRun -AppImage: - update-information: 'gh-releases-zsync|linux-nvme|nvme-cli|latest|*x86_64.AppImage.zsync' - arch: x86_64 diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml deleted file mode 100644 index 9768c70c9d..0000000000 --- a/.github/workflows/appimage.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -name: appimage - -on: - push: - branches: [master] - pull_request: - branches: [master] -env: - DESTDIR: ../AppDir - -jobs: - build-appimage: - name: build AppImage - runs-on: ubuntu-latest - container: - image: ghcr.io/linux-nvme/debian:latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: fixup permissions - env: - GITHUB_WORKSPACE: ${{ github.workspace }} - run: | - git config --global --add safe.directory "${GITHUB_WORKSPACE}" - - name: build - run: | - scripts/build.sh appimage - - name: build AppImage - uses: AppImageCrafters/build-appimage@v1.3 - with: - recipe: .github/AppImageBuilder.yml - - uses: actions/upload-artifact@v4 - name: upload artifacts to github - with: - name: AppImage - path: '*.AppImage*' - - deploy-appimage: - name: deploy AppImage - runs-on: ubuntu-latest - needs: build-appimage - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'linux-nvme/nvme-cli' }} - steps: - - uses: actions/download-artifact@v4 - with: - name: AppImage - path: AppImage - - name: FTP Deployer - uses: sand4rt/ftp-deployer@v1.8 - with: - sftp: true - host: ${{ secrets.SFTP_SERVER }} - port: 22 - username: ${{ secrets.SFTP_USERNAME }} - password: ${{ secrets.SFTP_PASSWORD }} - remote_folder: '/upload' - local_folder: '.' - cleanup: false - include: '[ "*", "**/*" ]' - exclude: '[".github/**", ".git/**", "*.env"]' diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 0000000000..fd76f034aa --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,86 @@ +name: upload + +on: + push: + branches: [master] + release: + types: [published] + +jobs: + build-static: + name: build static binary + runs-on: ubuntu-latest + container: + image: ghcr.io/linux-nvme/debian:latest + outputs: + VERSION: ${{ steps.build.outputs.VERSION }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: build + id: build + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + VERSION="$(git describe --always --abbrev=12 --dirty)" + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + echo $VERSION + + scripts/build.sh static + mkdir upload + cp .build-ci/nvme upload/nvme-cli-latest-x86_64 + if [ "${GITHUB_EVENT_NAME}" = "release" ]; then + cp .build-ci/nvme "upload/nvme-cli-${VERSION}-x86_64" + fi + + - uses: actions/upload-artifact@v4 + name: upload artifacts to github + with: + name: nvme-cli + path: upload/* + + upload-test-binary: + name: upload test binary + runs-on: ubuntu-latest + needs: build-static + if: ${{ github.event_name == 'push' || github.event_name == 'release' }} + steps: + - uses: actions/download-artifact@v4 + with: + name: nvme-cli + path: upload + + - name: FTP Deployer + uses: sand4rt/ftp-deployer@v1.8 + with: + sftp: true + host: ${{ secrets.SFTP_SERVER }} + port: 22 + username: ${{ secrets.SFTP_USERNAME }} + password: ${{ secrets.SFTP_PASSWORD }} + remote_folder: '/upload' + local_folder: upload + cleanup: false + include: '[ "nvme-cli-*" ]' + exclude: '[".github/**", ".git/**", "*.env"]' + + upload-release-assets: + name: upload GitHub release assets + runs-on: ubuntu-latest + needs: build-static + env: + VERSION: ${{ needs.build-static.outputs.VERSION }} + if: ${{ github.event_name == 'release' }} + steps: + - uses: actions/download-artifact@v4 + with: + name: nvme-cli + path: upload + - name: upload versioned binary + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: upload/nvme-cli-${{ env.VERSION }}-x86_64 + asset_name: nvme-cli-${{ env.VERSION }}-x86_64 + asset_content_type: application/octet-stream diff --git a/Makefile b/Makefile index 30830fbc54..0631f40d10 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ static: meson setup ${BUILD-DIR} --buildtype=release \ --wrap-mode=forcefallback \ --default-library=static \ + --prefix=/usr \ -Dc_link_args="-static" \ -Dlibnvme:default_library=static \ -Dlibnvme:keyutils=disabled \ diff --git a/README.md b/README.md index 1113b1e400..77f4b4344d 100644 --- a/README.md +++ b/README.md @@ -329,7 +329,7 @@ sees the complete file. ## Testing -For testing purposes a x86_64 AppImage is build from the current HEAD and is +For testing purposes a x86_64 static build from the current HEAD and is available here: -https://monom.org/linux-nvme/upload/AppImage/nvme-cli-latest-x86_64.AppImage +https://monom.org/linux-nvme/upload/nvme-cli-latest-x86_64 diff --git a/scripts/build.sh b/scripts/build.sh index 3b70f801d5..dd89a6b00e 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -20,7 +20,6 @@ usage() { echo " and build them as shared libraries" echo " cross use cross toolchain to build" echo " coverage build coverage report" - echo " appimage build AppImage target" echo " distro build libnvme and nvme-cli separately" echo " docs build documentation" echo " static build a static binary" @@ -108,16 +107,6 @@ config_meson_coverage() { "${BUILDDIR}" } -config_meson_appimage() { - CC="${CC}" "${MESON}" setup \ - --werror \ - --buildtype="${BUILDTYPE}" \ - --force-fallback-for=libnvme \ - --prefix=/usr \ - -Dlibnvme:werror=false \ - "${BUILDDIR}" -} - config_meson_docs() { CC="${CC}" "${MESON}" setup \ -Ddocs=all \ @@ -133,6 +122,7 @@ config_meson_static() { --buildtype=release \ --default-library=static \ --wrap-mode=forcefallback \ + --prefix=/usr \ -Dc_link_args="-static" \ -Dlibnvme:keyutils=disabled \ "${BUILDDIR}" @@ -154,11 +144,6 @@ test_meson_coverage() { ninja -C "${BUILDDIR}" coverage --verbose } -install_meson_appimage() { - "${MESON}" install \ - -C "${BUILDDIR}" -} - install_meson_docs() { "${MESON}" install \ -C "${BUILDDIR}"