aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/package-integration')
-rwxr-xr-xtests/package-integration42+42 −0
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/package-integration b/tests/package-integration
new file mode 100755
--- /dev/null
+++ b/tests/package-integration
@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-FileCopyrightText: 2026 Nikolay Govorov
+# SPDX-License-Identifier: 0BSD
+
+set -eu
+
+root=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
+work=$(mktemp -d)
+trap 'rm -rf "$work"' EXIT HUP INT TERM
+
+mkdir -p "$work/stage"
+printf 'package contract\n' > "$work/stage/package-contract"
+cat > "$work/nfpm.yaml" <<'EOF'
+name: package-contract
+arch: ${ARCH}
+version: ${VERSION}
+platform: linux
+maintainer: Dimidium Labs <me@govorov.online>
+description: Shared package task integration fixture
+license: 0BSD
+EOF
+
+mise --cd "$root" run package -- \
+ --config "$work/nfpm.yaml" \
+ --version '1.2.3~nightly.42' \
+ --arch amd64 \
+ --output "$work/out" \
+ --archive-root "$work/stage" \
+ --archive-name package-contract-linux-amd64 \
+ deb rpm apk tar.gz zip
+
+test "$(find "$work/out" -maxdepth 1 -name '*.deb' | wc -l)" -eq 1
+test "$(find "$work/out" -maxdepth 1 -name '*.rpm' | wc -l)" -eq 1
+test "$(find "$work/out" -maxdepth 1 -name '*.apk' | wc -l)" -eq 1
+test -f "$work/out/package-contract-linux-amd64.tar.gz"
+test -f "$work/out/package-contract-linux-amd64.zip"
+
+test "$(dpkg-deb -f "$work/out"/*.deb Package)" = package-contract
+test "$(dpkg-deb -f "$work/out"/*.deb Version)" = '1.2.3~nightly.42'
+test "$(dpkg-deb -f "$work/out"/*.deb Architecture)" = amd64
+tar -tzf "$work/out/package-contract-linux-amd64.tar.gz" | grep -q './package-contract'
+unzip -l "$work/out/package-contract-linux-amd64.zip" | grep -q 'package-contract'