From db918f813d0e194c3235df356354c869949854f4 Mon Sep 17 00:00:00 2001 From: veno Date: Sun, 30 Aug 2026 22:14:39 +0800 Subject: [PATCH] ci: build distributions on main updates --- .github/workflows/desktop-build.yml | 197 +++++++++++++++++++++- .github/workflows/linux-nightly.yml | 229 -------------------------- .github/workflows/release-desktop.yml | 14 +- 3 files changed, 199 insertions(+), 241 deletions(-) delete mode 100644 .github/workflows/linux-nightly.yml diff --git a/.github/workflows/desktop-build.yml b/.github/workflows/desktop-build.yml index 51f622a..db480bf 100644 --- a/.github/workflows/desktop-build.yml +++ b/.github/workflows/desktop-build.yml @@ -81,16 +81,25 @@ jobs: target: universal-apple-darwin rustTargets: aarch64-apple-darwin,x86_64-apple-darwin bundles: dmg + artifact: ci-macos-universal + paths: src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg - name: Windows x64 NSIS platform: windows-latest target: x86_64-pc-windows-msvc rustTargets: x86_64-pc-windows-msvc bundles: nsis + artifact: ci-windows-x86_64 + paths: src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe - name: Linux x64 packages platform: ubuntu-22.04 target: x86_64-unknown-linux-gnu rustTargets: x86_64-unknown-linux-gnu bundles: deb,rpm + artifact: ci-linux-x86_64 + paths: | + src-tauri/target/x86_64-unknown-linux-gnu/release/derivon-app + src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb + src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm steps: - name: Checkout uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 @@ -140,29 +149,199 @@ jobs: scripts/ci/verify-linux-package.sh deb "$deb" "$RELEASE_VERSION" scripts/ci/verify-linux-package.sh rpm "$rpm" "$RELEASE_VERSION" - - name: Upload Linux packages - if: runner.os == 'Linux' + - name: Upload build output + if: runner.os == 'Linux' || github.event_name != 'pull_request' + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: ${{ matrix.artifact }} + if-no-files-found: error + retention-days: 7 + path: ${{ matrix.paths }} + + distro-canary: + name: ${{ matrix.name }} + if: github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + include: + - name: Fedora latest RPM + image: fedora:latest + kind: rpm + - name: Debian 12 DEB + image: debian:12 + kind: deb + steps: + - name: Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Download Linux packages + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: ci-linux-x86_64 + path: artifacts/linux + + - name: Install and launch package + env: + IMAGE: ${{ matrix.image }} + KIND: ${{ matrix.kind }} + run: | + docker run --rm \ + --env KIND \ + --volume "$GITHUB_WORKSPACE:/work" \ + --workdir /work \ + "$IMAGE" \ + bash -lc ' + set -euo pipefail + case "$KIND" in + rpm) dnf install -y rpm findutils util-linux dbus-x11 xorg-x11-server-Xvfb ;; + deb) apt-get update && apt-get install -y ca-certificates findutils util-linux dbus-x11 xvfb ;; + esac + package=$(find artifacts/linux -type f -name "*.$KIND" -print -quit) + package=$(realpath "$package") + version=$(case "$KIND" in rpm) rpm -qp --queryformat "%{VERSION}" "$package";; deb) dpkg-deb -f "$package" Version;; esac) + scripts/ci/verify-linux-package.sh "$KIND" "$package" "$version" + case "$KIND" in + rpm) dnf install -y "$package" ;; + deb) apt-get install -y "$package" ;; + esac + scripts/ci/smoke-linux-app.sh derivon-app + ' + + arch-source: + name: Arch source build + if: github.event_name != 'pull_request' + needs: quality + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Render source recipe + run: | + version=$(node -p 'require("./package.json").version') + mkdir -p dist/arch-ci + git archive --format=tar --prefix="derivon-mindmap-$version/" HEAD | gzip -n > "dist/arch-ci/derivon-mindmap-$version-source.tar.gz" + checksum=$(sha256sum "dist/arch-ci/derivon-mindmap-$version-source.tar.gz" | cut -d ' ' -f 1) + node scripts/render-arch-package.mjs \ + "$version" \ + "file:///build/derivon-mindmap-$version-source.tar.gz" \ + "$checksum" \ + dist/arch-ci + + - name: Build in clean Arch container + run: | + docker run --rm \ + --volume "$GITHUB_WORKSPACE/dist/arch-ci:/input:ro" \ + archlinux:base-devel \ + bash -lc ' + set -euo pipefail + pacman -Syu --needed --noconfirm cargo nodejs npm gtk3 webkit2gtk-4.1 openssl hicolor-icon-theme + useradd --create-home builder + mkdir /build + cp -a /input/. /build/ + chown -R builder:builder /build + cd /build + runuser -u builder -- makepkg --nodeps --noconfirm --cleanbuild + ' + + build-flatpak: + name: Build Flatpak bundle + if: github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-22.04 + container: + image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-50 + options: --privileged + steps: + - name: Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Download Linux packages + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: ci-linux-x86_64 + path: artifacts/linux + + - name: Stage Flatpak binary + run: | + binary=$(find artifacts/linux -type f -name derivon-app -print -quit) + install -Dm755 "$binary" packaging/flatpak/files/derivon-app + + - name: Build Flatpak + uses: flatpak/flatpak-github-actions/flatpak-builder@79327416609af08178ad73b352877e51450790b3 # v6 + with: + bundle: Derivon-ci-x86_64.flatpak + manifest-path: packaging/flatpak/net.derivon.mindmap.yml + upload-artifact: false + + - name: Upload Flatpak uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: - name: pr-linux-x86_64 + name: ci-flatpak-x86_64 + path: Derivon-ci-x86_64.flatpak if-no-files-found: error retention-days: 7 - path: | - src-tauri/target/${{ matrix.target }}/release/derivon-app - src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb - src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm + + rocky-flatpak: + name: Rocky Linux 9 Flatpak + if: github.event_name != 'pull_request' + needs: build-flatpak + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Download Flatpak + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: ci-flatpak-x86_64 + path: artifacts/flatpak + + - name: Install and launch on Rocky Linux 9 + run: | + docker run --rm --privileged \ + --volume "$GITHUB_WORKSPACE:/work" \ + --workdir /work \ + rockylinux:9 \ + bash -lc ' + set -euo pipefail + dnf install -y flatpak dbus-x11 xorg-x11-server-Xvfb util-linux + bundle=$(find artifacts/flatpak -type f -name "*.flatpak" -print -quit) + flatpak install --system --noninteractive -y "$bundle" + scripts/ci/smoke-linux-app.sh flatpak run net.derivon.mindmap + ' ci-gate: name: CI Gate if: always() - needs: [quality, build] + needs: [quality, build, distro-canary, arch-source, build-flatpak, rocky-flatpak] runs-on: ubuntu-22.04 steps: - name: Confirm required checks passed env: QUALITY: ${{ needs.quality.result }} BUILD: ${{ needs.build.result }} + DISTRO_CANARY: ${{ needs.distro-canary.result }} + ARCH_SOURCE: ${{ needs.arch-source.result }} + BUILD_FLATPAK: ${{ needs.build-flatpak.result }} + ROCKY_FLATPAK: ${{ needs.rocky-flatpak.result }} run: | test "$QUALITY" = success test "$BUILD" = success - echo "Quality checks and all desktop bundles passed." + if [[ "$GITHUB_EVENT_NAME" != pull_request ]]; then + test "$DISTRO_CANARY" = success + test "$ARCH_SOURCE" = success + test "$BUILD_FLATPAK" = success + test "$ROCKY_FLATPAK" = success + fi + echo "Required quality, desktop, and distribution checks passed." diff --git a/.github/workflows/linux-nightly.yml b/.github/workflows/linux-nightly.yml deleted file mode 100644 index c933f8b..0000000 --- a/.github/workflows/linux-nightly.yml +++ /dev/null @@ -1,229 +0,0 @@ -name: Linux Distribution Nightly - -on: - schedule: - - cron: "23 3 * * *" - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: linux-distribution-nightly - cancel-in-progress: true - -env: - NODE_VERSION: "22" - -jobs: - build-linux: - name: Build Linux packages - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - - - name: Setup Node.js - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - - - name: Setup Rust - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable - with: - targets: x86_64-unknown-linux-gnu - - - name: Cache Rust build - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 - with: - workspaces: src-tauri -> target - shared-key: linux-nightly - - - name: Install build dependencies - run: | - sudo apt-get update - sudo apt-get install -y \ - libwebkit2gtk-4.1-dev \ - libayatana-appindicator3-dev \ - librsvg2-dev \ - libssl-dev \ - patchelf \ - rpm - - - name: Build required packages - env: - NO_STRIP: "true" - run: | - npm ci - npm run check:release-version - npm run tauri:build -- --target x86_64-unknown-linux-gnu --bundles deb,rpm -- --locked - - - name: Upload Linux packages - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 - with: - name: nightly-linux-x86_64 - if-no-files-found: error - retention-days: 7 - path: | - src-tauri/target/x86_64-unknown-linux-gnu/release/derivon-app - src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb - src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/rpm/*.rpm - - distro-canary: - name: ${{ matrix.name }} - needs: build-linux - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - include: - - name: Fedora latest RPM - image: fedora:latest - kind: rpm - - name: Debian 12 DEB - image: debian:12 - kind: deb - steps: - - name: Checkout - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - - - name: Download Linux packages - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 - with: - name: nightly-linux-x86_64 - path: artifacts/linux - - - name: Install and launch package - env: - IMAGE: ${{ matrix.image }} - KIND: ${{ matrix.kind }} - run: | - docker run --rm \ - --env KIND \ - --volume "$GITHUB_WORKSPACE:/work" \ - --workdir /work \ - "$IMAGE" \ - bash -lc ' - set -euo pipefail - case "$KIND" in - rpm) dnf install -y rpm findutils util-linux dbus-x11 xorg-x11-server-Xvfb ;; - deb) apt-get update && apt-get install -y ca-certificates findutils util-linux dbus-x11 xvfb ;; - esac - package=$(find artifacts/linux -type f -name "*.$KIND" -print -quit) - package=$(realpath "$package") - version=$(case "$KIND" in rpm) rpm -qp --queryformat "%{VERSION}" "$package";; deb) dpkg-deb -f "$package" Version;; esac) - scripts/ci/verify-linux-package.sh "$KIND" "$package" "$version" - case "$KIND" in - rpm) dnf install -y "$package" ;; - deb) apt-get install -y "$package" ;; - esac - scripts/ci/smoke-linux-app.sh derivon-app - ' - - arch-source: - name: Arch source build - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Render source recipe - run: | - version=$(node -p 'require("./package.json").version') - mkdir -p dist/arch-nightly - git archive --format=tar --prefix="derivon-mindmap-$version/" HEAD | gzip -n > "dist/arch-nightly/derivon-mindmap-$version-source.tar.gz" - checksum=$(sha256sum "dist/arch-nightly/derivon-mindmap-$version-source.tar.gz" | cut -d ' ' -f 1) - node scripts/render-arch-package.mjs \ - "$version" \ - "file:///build/derivon-mindmap-$version-source.tar.gz" \ - "$checksum" \ - dist/arch-nightly - - - name: Build in clean Arch container - run: | - docker run --rm \ - --volume "$GITHUB_WORKSPACE/dist/arch-nightly:/input:ro" \ - archlinux:base-devel \ - bash -lc ' - set -euo pipefail - pacman -Syu --needed --noconfirm cargo nodejs npm gtk3 webkit2gtk-4.1 openssl hicolor-icon-theme - useradd --create-home builder - mkdir /build - cp -a /input/. /build/ - chown -R builder:builder /build - cd /build - runuser -u builder -- makepkg --nodeps --noconfirm --cleanbuild - ' - - build-flatpak: - name: Build Flatpak bundle - needs: build-linux - runs-on: ubuntu-22.04 - container: - image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-50 - options: --privileged - steps: - - name: Checkout - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - - - name: Download Linux packages - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 - with: - name: nightly-linux-x86_64 - path: artifacts/linux - - - name: Stage Flatpak binary - run: | - binary=$(find artifacts/linux -type f -name derivon-app -print -quit) - install -Dm755 "$binary" packaging/flatpak/files/derivon-app - - - name: Build Flatpak - uses: flatpak/flatpak-github-actions/flatpak-builder@79327416609af08178ad73b352877e51450790b3 # v6 - with: - bundle: Derivon-nightly-x86_64.flatpak - manifest-path: packaging/flatpak/net.derivon.mindmap.yml - upload-artifact: false - - - name: Upload Flatpak - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 - with: - name: nightly-flatpak-x86_64 - path: Derivon-nightly-x86_64.flatpak - if-no-files-found: error - retention-days: 7 - - rocky-flatpak: - name: Rocky Linux 9 Flatpak - needs: build-flatpak - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 - - - name: Download Flatpak - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 - with: - name: nightly-flatpak-x86_64 - path: artifacts/flatpak - - - name: Install and launch on Rocky Linux 9 - run: | - docker run --rm --privileged \ - --volume "$GITHUB_WORKSPACE:/work" \ - --workdir /work \ - rockylinux:9 \ - bash -lc ' - set -euo pipefail - dnf install -y flatpak dbus-x11 xorg-x11-server-Xvfb util-linux - bundle=$(find artifacts/flatpak -type f -name "*.flatpak" -print -quit) - flatpak install --system --noninteractive -y "$bundle" - scripts/ci/smoke-linux-app.sh flatpak run net.derivon.mindmap - ' diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.yml index a7fa657..a07b3a9 100644 --- a/.github/workflows/release-desktop.yml +++ b/.github/workflows/release-desktop.yml @@ -368,10 +368,18 @@ jobs: VERSION: ${{ needs.validate.outputs.version }} run: | docker run --rm \ - --volume "$GITHUB_WORKSPACE/dist/arch-release:/work" \ - --workdir /work \ + --volume "$GITHUB_WORKSPACE/dist/arch-release:/input:ro" \ archlinux:base-devel \ - bash -lc 'useradd --create-home builder && chown -R builder:builder /work && runuser -u builder -- makepkg --printsrcinfo > .SRCINFO' + bash -lc ' + set -euo pipefail + useradd --create-home builder + mkdir /build + cp /input/PKGBUILD /build/ + chown -R builder:builder /build + cd /build + runuser -u builder -- makepkg --printsrcinfo + ' \ + > dist/arch-release/.SRCINFO cp "dist/arch-test/derivon-mindmap-${VERSION}-source.tar.gz" dist/arch-release/ tar -C dist/arch-release -czf "dist/derivon-mindmap-${VERSION}-arch-recipe.tar.gz" PKGBUILD .SRCINFO