diff --git a/.dockerignore b/.dockerignore index 04f3214..cee0b99 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,2 @@ -.git .github Dockerfile diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index 5d287f8..73ab530 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -1,8 +1,9 @@ name: Build and publish AppImages env: - UBUNTU_RELEASE: jammy - UBUNTU_PUBKEY: 871920D1991BC93C + # pinned to 2026-11-28 snapshots + SHARUN_URL: https://github.com/pkgforge-dev/Anylinux-AppImages/raw/b00d53f92c825818f3d86c77bad577d79acc17d2/useful-tools/quick-sharun.sh + BASE_IMAGE: ghcr.io/pkgforge-dev/archlinux@sha256:69c3ae2d3f8a58cdb61b63afacc943d58f998ed4435eca2755f3cd478920d9a2 on: pull_request: @@ -13,56 +14,44 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} strategy: fail-fast: true matrix: - platform: - - linux/amd64 - - linux/arm64 + include: + - platform: linux/amd64 + runner: ubuntu-26.04 + - platform: linux/arm64 + runner: ubuntu-26.04-arm steps: - - uses: actions/checkout@v4 - - uses: rlespinasse/github-slug-action@v4 + - name: Checkout + uses: actions/checkout@v7 + with: # args are required for git-based version detection + ref: ${{ github.ref }} + fetch-depth: 20 + fetch-tags: true - - name: Setup qemu for docker - uses: docker/setup-qemu-action@v3 - if: matrix.platform != 'linux/amd64' + - name: Expose slug values + uses: rlespinasse/github-slug-action@v5 - name: Setup buildx for docker - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - - name: Compile in docker - uses: docker/build-push-action@v5 + - name: Build AppImage + uses: docker/build-push-action@v7 with: + context: . # explicit path context is required for git-based version detection platforms: ${{ matrix.platform }} outputs: build build-args: | - UBUNTU_RELEASE - - - name: Prepare environment for building AppImage - env: - TARGET_PLATFORM: ${{ matrix.platform }} - shell: bash - run: | - set -eua - . build/.build-metadata.env - rm build/.build-metadata.env - APPIMAGE_SOURCE=build - APPIMAGE_VERSION="${GITHUB_REF_SLUG}" - APPIMAGE_APT_ARCH="${TARGETARCH}" - APPIMAGE_APT_DISTRO="${UBUNTU_RELEASE}" - APPIMAGE_APT_PUBKEY="${UBUNTU_PUBKEY}" - APPIMAGE_ARCH="${TARGETMACHINE}" - printenv | grep ^APPIMAGE_ >>"${GITHUB_ENV}" - - - name: Build AppImage - uses: AppImageCrafters/build-appimage@v1.3 - with: - recipe: dist/AppImageBuilder.yml + BASE_IMAGE + SHARUN_URL + OWNER=${{ env.GITHUB_REPOSITORY_OWNER_PART }} - - uses: rlespinasse/slugify-value@v1.x + - name: Slugify platform + uses: rlespinasse/slugify-value@v1 id: platform-slug with: key: PLATFORM @@ -70,20 +59,68 @@ jobs: publish-env: false - name: Upload artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: - name: appimage-${{steps.platform-slug.outputs.slug-url}} + name: appimage-${{ steps.platform-slug.outputs.slug-url }} path: | - ./*.AppImage - ./*.AppImage.zsync + build/*.AppImage + build/*.AppImage.zsync if-no-files-found: error + test: + runs-on: ${{ matrix.runner }} + + needs: + - build + + strategy: + fail-fast: false + matrix: + include: + - platform: linux/amd64 + runner: ubuntu-26.04 + - platform: linux/arm64 + runner: ubuntu-26.04-arm + + steps: + - name: Slugify platform + uses: rlespinasse/slugify-value@v1 + id: platform-slug + with: + key: PLATFORM + value: ${{ matrix.platform }} + publish-env: false + + - name: Download artifacts + uses: actions/download-artifact@v8 + with: + path: assets + pattern: appimage-${{ steps.platform-slug.outputs.slug-url }} + + - name: Test AppImage on Alpine + uses: addnab/docker-run-action@v3 + with: + image: alpine + options: -v ${{ github.workspace }}/assets:/appimage + run: | + apk add coreutils + find /appimage/ -type f -name '*.AppImage' | while read -r appimage; do + chmod +x "${appimage}" + timeout 5 "${appimage}" + rc="$?" + if [ "$rc" -ne 124 ]; then + echo >&2 "AppImage returned unexpected code $rc." + if [ "$rc" -ne 0 ]; then exit "$rc"; else exit 1; fi + fi + done + release: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: - build + - test permissions: contents: write @@ -95,6 +132,7 @@ jobs: path: assets pattern: appimage-* merge-multiple: true + - name: Create checksum for release assets shell: bash run: | @@ -102,6 +140,7 @@ jobs: find assets -type f | while read -r asset; do shasum --binary --algorithm "${algo}" "${asset}" >"${asset}.sha${algo}" done + - name: Upload artifacts to GitHub release uses: softprops/action-gh-release@v1 with: diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index bab1663..bb59b7e 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Install dependencies uses: awalsh128/cache-apt-pkgs-action@latest diff --git a/Dockerfile b/Dockerfile index ed3cfdd..47b4bd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,53 @@ -ARG UBUNTU_RELEASE=jammy +# syntax=docker/dockerfile:1 +ARG BASE_IMAGE=ghcr.io/pkgforge-dev/archlinux +FROM $BASE_IMAGE AS build-stage -FROM ubuntu:$UBUNTU_RELEASE AS build-stage -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - git ca-certificates build-essential libudev-dev libevdev-dev zlib1g-dev valac libgee-0.8-dev meson - -COPY . / +# Install project dependencies +RUN pacman -Syu --noconfirm meson base-devel vala git libgee libevdev +# Build project +COPY . /project +WORKDIR /project ARG BUILD_TYPE=release ARG ENABLE_LTO=true ARG TARGETOS TARGETARCH TARGETVARIANT +ARG VERSION +RUN <>/release/.build-metadata.env + curl -fsSL -w "%{stderr}AnyLinux: %{url}\n" "${SHARUN_URL}" | install /dev/stdin ./quick-sharun.sh + test -s ./quick-sharun.sh + ./quick-sharun.sh "/usr/bin/${APP_NAME}" + ./quick-sharun.sh --make-appimage +EOF FROM scratch AS export-stage -COPY --from=build-stage /release/ /release/.build-metadata.env / +COPY --from=build-stage /appimage/* / diff --git a/dist/AppImageBuilder.yml b/dist/AppImageBuilder.yml deleted file mode 100644 index c29be17..0000000 --- a/dist/AppImageBuilder.yml +++ /dev/null @@ -1,55 +0,0 @@ -version: 1 - -script: -- | - mv "{{APPIMAGE_SOURCE}}" "${TARGET_APPDIR}" - icon_path="${TARGET_APPDIR}/usr/share/icons/hicolor/128x128/apps" - mkdir -p "${icon_path}" - cp -a dist/evdevhook2.png "${icon_path}" - # Manual installation is required until fix of https://github.com/AppImageCrafters/build-appimage/issues/5 - if ! command -v mksquashfs >/dev/null; then - apt-get update && apt-get install -y --no-install-recommends squashfs-tools - fi - -AppDir: - app_info: - id: org.v1993.evdevhook2 - name: evdevhook2 - version: "{{APPIMAGE_VERSION}}" - icon: evdevhook2 - exec: usr/bin/evdevhook2 - exec_args: $@ - - after_runtime: | - echo "X-AppImage-Integrate=false" >> "${TARGET_APPDIR}/org.v1993.evdevhook2.desktop" - - apt: - arch: - - "{{APPIMAGE_APT_ARCH}}" - sources: - - sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ "{{APPIMAGE_APT_DISTRO}}" main - key_url: "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{APPIMAGE_APT_PUBKEY}}" - - sourceline: deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ "{{APPIMAGE_APT_DISTRO}}"-updates main - - sourceline: deb [arch=amd64] http://security.ubuntu.com/ubuntu/ "{{APPIMAGE_APT_DISTRO}}"-security main - - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ "{{APPIMAGE_APT_DISTRO}}" main - - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ "{{APPIMAGE_APT_DISTRO}}"-updates main - - sourceline: deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ "{{APPIMAGE_APT_DISTRO}}"-security main - include: - - libudev1 - - libevdev2 - - libglib2.0-0 - - libgee-0.8-2 - - files: - exclude: - - usr/share/man - - usr/share/doc/*/README.* - - usr/share/doc/*/changelog.* - - usr/share/doc/*/NEWS.* - - usr/share/doc/*/TODO.* - - usr/share/lintian - - usr/lib/*/glib-2.0 - -AppImage: - arch: "{{APPIMAGE_ARCH}}" - update-information: "gh-releases-zsync|v1993|evdevhook2|latest|evdevhook2-*-{{APPIMAGE_ARCH}}.AppImage.zsync" diff --git a/dist/evdevhook2.desktop b/dist/evdevhook2.desktop new file mode 100644 index 0000000..df3bbfc --- /dev/null +++ b/dist/evdevhook2.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=evdevhook2 +Exec=usr/bin/evdevhook2 +Icon=evdevhook2 +StartupWMClass=evdevhook2 +Type=Application +Terminal=false +Categories=Utility; +Comment= diff --git a/meson.build b/meson.build index 3ac7829..555deab 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project('evdevhook2', ['c', 'vala'], - version: '1.0.2', + version: '0.0.0', meson_version: '>= 0.50.0', default_options: [ 'warning_level=2', ],