diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index d280912..8a248e0 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -51,12 +51,36 @@ on: description: 'Publier une release avec suffixe (ex. 1.0.0-rc1) malgré le fail-fast par défaut.' required: false type: boolean - default: false + default: true + workflow_call: + inputs: + tag: + description: 'Tag pazof/yavsc à packager (requis en dispatch, ex. 1.0.6 ou 1.0.7-rc1).' + required: true + type: string + force_unstable: + description: 'Publier une release avec suffixe (ex. 1.0.0-rc1) malgré le fail-fast par défaut.' + required: false + type: boolean + default: true +env: + FORCE_UNSTABLE: ${{ inputs.force_unstable || 'false' }} + TAG: ${{ forgejo.event_name == 'push' && forgejo.ref_name || inputs.tag }} permissions: contents: write jobs: + + log_inputs: + runs-on: docker + container: + image: docker.io/pazof/yavsc-build-env:debian12-dotnet10-android36-v2 + steps: + - name: Log inputs + run: | + echo "TAG=$TAG" + echo "FORCE_UNSTABLE=$FORCE_UNSTABLE" # Job unique : validation tag/CHANGELOG + build amd64 + build # arm64 + publication via l'API REST Forgejo (pas d'actions # tierces Node). @@ -65,46 +89,15 @@ jobs: container: image: docker.io/pazof/yavsc-build-env:debian12-dotnet10-android36-v2 env: - STATE_FILE: /tmp/release-state.json + STATE_FILE: /tmp/release-state steps: - - name: Installer les pré-requis de build (debhelper + icônes) - # L'image runner fournit déjà dotnet-sdk-10.0, git, jq, - # curl. On ajoute les outils spécifiques au packaging - # Debian (debhelper, imagemagick pour les icônes .png - # via `convert`, librsvg2-bin pour le SVG). - run: | - apt-get update - # Cross-build deps for arm64: - # 1. dpkg --add-architecture arm64 + apt-get update — make - # apt aware of arm64 packages. - # 2. Install the arm64 RUNTIME libs (libc6:arm64, etc.) - # so dpkg-shlibdeps can resolve the .so dependencies - # of the arm64 binaries via the on-host shlibs cache. - # The runtime libs (not -dev:arm64) is what carries - # the SONAME metadata that dpkg-shlibdeps matches. - # 3. crossbuild-essential-arm64 pulls gcc/binutils for - # arm64, plus dpkg-cross CONFIG_SITE files under - # /etc/dpkg-cross/. The cross-gcc is unused for our - # dotnet-only build but harmless. - dpkg --add-architecture arm64 - apt-get update - apt-get install -y --no-install-recommends \ - build-essential debhelper imagemagick librsvg2-bin \ - ca-certificates crossbuild-essential-arm64 \ - libc6:arm64 libstdc++6:arm64 \ - libfontconfig1:arm64 libfreetype6:arm64 \ - libgtk-3-0:arm64 - rm -rf /var/lib/apt/lists/* - : > "$STATE_FILE" - - - name: Clone du repo au tag demandé - env: - TAG: ${{ forgejo.event_name == 'push' && forgejo.ref_name || inputs.tag }} + - name: Clone du repo run: | if [[ -z "$TAG" ]]; then echo "::error::No tag provided. In workflow_dispatch, set the 'tag' input." exit 1 fi + echo "→ Cloning repo" cd /src if [[ ! -d _src/.git ]]; then @@ -114,100 +107,6 @@ jobs: git clone https://forgejo.pschneider.fr/notazof/postit-debian.git _src fi - cd _src - git fetch --tags --force --prune origin - git checkout "$TAG" - - echo "Checked out at $(git rev-parse HEAD) on tag $TAG" - - # Persist TAG in the state file. --arg ensures proper - # JSON escaping of any special chars. - jq -n --arg tag "$TAG" '{tag: $tag}' > "$STATE_FILE" - - - name: Valider le tag et la section CHANGELOG - run: | - TAG=$(jq -r '.tag' "$STATE_FILE") - cd /src/_src - echo "Validating tag $TAG" - - # Parse semver : MAJOR.MINOR.PATCH[-SUFFIX] - if [[ ! "$TAG" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-.*)?$ ]]; then - echo "::error::Tag '$TAG' does not match MAJOR.MINOR.PATCH[-SUFFIX] format." - exit 1 - fi - - MAJOR="${BASH_REMATCH[1]}" - MINOR="${BASH_REMATCH[2]}" - PATCH="${BASH_REMATCH[3]}" - SUFFIX="${BASH_REMATCH[4]}" - - # Classification du canal par parité du patch. - if [[ -n "$SUFFIX" ]]; then - CHANNEL="unstable" - elif (( PATCH % 2 == 0 )); then - CHANNEL="stable" - else - CHANNEL="preview" - fi - - echo "Tag $TAG classifié comme channel=$CHANNEL" - - # Fail-fast sur instable sauf opt-in explicite. - if [[ "$CHANNEL" == "unstable" && "${FORCE_UNSTABLE:-false}" != "true" ]]; then - echo "::error::Tag '$TAG' is unstable (suffix '$SUFFIX'). Refusing to publish." - echo "Set force_unstable=true via workflow_dispatch to override." - exit 1 - fi - - # Lecture du CHANGELOG.md (doit exister à la racine du repo). - if [[ ! -f CHANGELOG.md ]]; then - echo "::error::CHANGELOG.md not found at repo root." - exit 1 - fi - - # Extraction de la section [TAG]. On garde le titre - # (ligne `## [TAG] - channel`) pour la vérification du - # canal, puis on l'exclut du body envoyé à la release. - BODY=$(awk -v tag="[$TAG]" ' - /^## \[/ { - if (in_section) exit - if (index($0, tag) > 0) { - in_section=1 - print - next - } - } - in_section { print } - ' CHANGELOG.md) - - if [[ -z "$BODY" ]]; then - echo "::error::No section matching '## [$TAG]' found in CHANGELOG.md." - echo "Add a '## [$TAG] - $CHANNEL' section before tagging." - exit 1 - fi - - # Vérification cohérence du canal déclaré dans le titre. - TITLE=$(echo "$BODY" | head -1) - if [[ "$TITLE" != *" - $CHANNEL"* ]]; then - echo "::error::Section title '$TITLE' must declare suffix '- $CHANNEL' to match tag parity." - exit 1 - fi - - RELEASE_BODY=$(echo "$BODY" | tail -n +2) - IS_PRERELEASE=$([ "$CHANNEL" = "stable" ] && echo false || echo true) - - echo "Section CHANGELOG validée pour [$TAG] - $CHANNEL" - - # Persist validation results. Use --arg for strings (so - # jq handles escaping of backticks, asterisks, colons, - # etc.) and --argjson for booleans. - jq -n \ - --arg tag "$TAG" \ - --arg body "$RELEASE_BODY" \ - --argjson is_prerelease "$IS_PRERELEASE" \ - '{tag: $tag, body: $body, is_prerelease: $is_prerelease}' \ - > "$STATE_FILE" - - name: Build .deb amd64 env: POSTIT_RUNTIME: linux-x64 diff --git a/Makefile b/Makefile index 43e7fc5..c941e73 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,10 @@ # POSTIT_RUNTIME default: linux-x64 (override to linux-arm64 etc.) # POSTIT_OUT_DIR default: $(CURDIR)/.. (artifacts land here) -POSTIT_GIT_URL ?= https://github.com/pazof/yavsc.git -POSTIT_GIT_TAG ?= 1.0.6 +POSTIT_GIT_URL ?= https://forgejo.pschneider.fr/notazof/yavsc.git +POSTIT_GIT_TAG ?= 1.0.8-rc28 POSTIT_RUNTIME ?= linux-x64 +# since dpkg-buildpackage produces the .deb in .. POSTIT_OUT_DIR ?= $(CURDIR)/.. .PHONY: deb clean source test @@ -44,7 +45,10 @@ deb: # previous build just produced). The pattern is the same one # dpkg-deb will reuse if we don't clean up first: postit_- # 1_.deb. - rm -f ../postit_$(POSTIT_GIT_TAG)-1_$${DPKG_HOST}.deb ../postit_$(POSTIT_GIT_TAG)-1_$${DPKG_HOST}.buildinfo ../postit_$(POSTIT_GIT_TAG)-1_$${DPKG_HOST}.changes + rm -f $(POSTIT_OUT_DIR)/postit_$(POSTIT_GIT_TAG)-1_$${DPKG_HOST}.deb \ + $(POSTIT_OUT_DIR)/postit_$(POSTIT_GIT_TAG)-1_$${DPKG_HOST}.buildinfo \ + $(POSTIT_OUT_DIR)/postit_$(POSTIT_GIT_TAG)-1_$${DPKG_HOST}.changes + # Use dpkg-architecture to set the target arch correctly for # cross-builds. For POSTIT_RUNTIME=linux-arm64, this exports # DEB_HOST_ARCH=arm64 (and friends) so dpkg-buildpackage names @@ -77,7 +81,8 @@ deb: # would normally export (host arch, build arch, host GNU # type, build GNU type) so debhelper rules see a consistent # cross-build environment. - DPKG_HOST=$$(case "$(POSTIT_RUNTIME)" in linux-arm64) echo arm64 ;; linux-x64) echo amd64 ;; *) echo "unsupported POSTIT_RUNTIME=$(POSTIT_RUNTIME)" >&2; exit 1 ;; esac) && DEB_HOST_ARCH=$$DPKG_HOST DEB_BUILD_ARCH=amd64 DEB_HOST_GNU_TYPE=aarch64-linux-gnu DEB_BUILD_GNU_TYPE=x86_64-linux-gnu POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) dpkg-buildpackage -us -uc -b -d -Pcross -a$$DPKG_HOST + DPKG_HOST=$$(case "$(POSTIT_RUNTIME)" in linux-arm64) echo arm64 ;; linux-x64) echo amd64 ;; *) echo "unsupported POSTIT_RUNTIME=$(POSTIT_RUNTIME)" >&2; exit 1 ;; esac) && DEB_HOST_ARCH=$$DPKG_HOST DEB_BUILD_ARCH=amd64 DEB_HOST_GNU_TYPE=aarch64-linux-gnu DEB_BUILD_GNU_TYPE=x86_64-linux-gnu POSTIT_GIT_URL=$(POSTIT_GIT_URL) POSTIT_GIT_TAG=$(POSTIT_GIT_TAG) POSTIT_RUNTIME=$(POSTIT_RUNTIME) dpkg-buildpackage -us -uc -b -d -Pcross -a$$DPKG_HOST + # dpkg-buildpackage already writes the produced .deb to # /src/_src/../ = $POSTIT_OUT_DIR (its default — there's no # flag to change it). So no 'mv' is needed. The old 'mv' diff --git a/debian/rules b/debian/rules index 7592306..d52c40c 100755 --- a/debian/rules +++ b/debian/rules @@ -125,6 +125,21 @@ override_dh_auto_test: # (Yavsc.Org.Tests covers the web front, not the desktop # client). Build smoke is sufficient for the package. +# Native blobs shipped for platforms other than the host arch. +# The publish output embeds pv_recorder (and friends) for every +# RID the NuGet supports — raspberry-pi arm32/arm64, mac, windows +# — because the app picks the right one at runtime. dpkg-shlibdeps +# cannot resolve those foreign-arch binaries' NEEDED entries +# (libc.so.6, libm.so.6, ...) against the on-host shlibs cache, +# and they must not contribute to Depends: anyway (the host never +# loads them). Exclude them with -X, mirroring the dh_strip +# disable below. We keep scanning lib/linux// and the +# top-level .so files, which ARE the host's runtime deps. +SHLIBDEPS_EXCLUDES = \ + -Xusr/lib/postit/lib/raspberry-pi/ \ + -Xusr/lib/postit/lib/mac/ \ + -Xusr/lib/postit/lib/windows/ + override_dh_shlibdeps: # In a cross-build (DEB_HOST_ARCH != DEB_BUILD_ARCH), the # system's arch-specific lib dir is at @@ -141,13 +156,13 @@ override_dh_shlibdeps: HOST_LIB_DIR=/usr/lib/$${HOST_MULTIARCH}; \ if [ -d "$$HOST_LIB_DIR" ]; then \ echo " --> dh_shlibdeps: cross-arch $$HOST_LIB_DIR (DEB_HOST_ARCH=$(DEB_HOST_ARCH))"; \ - dh_shlibdeps -- -l"$$HOST_LIB_DIR"; \ + dh_shlibdeps $(SHLIBDEPS_EXCLUDES) -- -l"$$HOST_LIB_DIR"; \ else \ echo " --> dh_shlibdeps: WARN cross-arch dir $$HOST_LIB_DIR missing"; \ - dh_shlibdeps; \ + dh_shlibdeps $(SHLIBDEPS_EXCLUDES); \ fi \ else \ - dh_shlibdeps; \ + dh_shlibdeps $(SHLIBDEPS_EXCLUDES); \ fi override_dh_strip: