~graywolf/acme-client-portable

a8cf76725b5acf1cf438559a6a9e62f0d80b4e2b — Wolf 3 months ago 5748f60
Add script to check release tarball

It is necessary to validate, that the released tarball actually contains
everything necessary to compile the program without any additional
dependencies (for example bison). This script can be used to take any
tarball for a spin using the sr.ht's build jobs.
1 files changed, 151 insertions(+), 0 deletions(-)

A _tools/tarball-check
A _tools/tarball-check => _tools/tarball-check +151 -0
@@ 0,0 1,151 @@
#!/bin/sh
set -eu

if [ -z "${VER-}" ]; then
	echo >&2 'Env variable VER must be provided. Example value: 1.3.0-rc1'
	exit 1
fi

if [ -z "${TOKEN-}" ]; then
	echo >&2 'Env variable TOKEN must contain sr.ht access token.'
	exit 1
fi

post_manifest() (
	printf '%s\n' "$1"

	note=$(printf '$N' | jq --arg N "$1" -nf /dev/stdin)
	manifest=$(printf '$M' | jq --arg M "$2" -nf /dev/stdin)
	op="mutation { submit(manifest: $manifest, note: $note) { id } }"
	query=$(printf '{"query": $OP}' | jq --arg OP "$op" -nf /dev/stdin)

	curl -sSl --fail-with-body -XPOST --data-binary "$query" \
		-HAuthorization:Bearer" $TOKEN" \
		-Hcontent-type:application/json \
		https://builds.sr.ht/query
	echo
)

post_manifest \
	"acme-client tarball check - alpine" \
	"$(jq --arg VER "$VER" -nf /dev/stdin <<'EOF'
{
  "environment": {
    "VER": $VER
  },
  "sources": [
    "https://git.sr.ht/~graywolf/acme-client-portable"
  ],
  "image": "alpine/latest",
  "packages": [
    "curl",
    "doas",
    "go",
    "libcap",
    "nginx",
    "openssl-dev"
  ],
  "tasks": [
    {
      "doas":
        "echo 'permit nopass build' | sudo tee /etc/doas.d/user.conf"
    },
    {
      "setup-hosts":
        "cd acme-client-portable/_tools && ./setup-hosts"
    },
    {
      "setup-pebble":
        "cd acme-client-portable/_tools && ./setup-pebble"
    },
    {
      "fetch":
        "curl -SsflO https://data.wolfsden.cz/sources/acme-client-$VER.tar.gz"
    },
    {
      "extract":
        "tar -xvf acme-client-$VER.tar.gz"
    },
    {
      "configure":
        "cd acme-client-$VER && ./configure --enable-test-build"
    },
    {
      "make":
        "cd acme-client-$VER && make"
    },
    {
      "make-check":
        "cd acme-client-$VER && make check"
    },
    {
      "make-distcheck":
        "cd acme-client-$VER && make GZIP_ENV= distcheck"
    }
  ]
}
EOF
)"

# archlinux:
post_manifest \
	"acme-client tarball check: archlinux with libtls" \
	"$(jq --arg VER "$VER" -nf /dev/stdin <<'EOF'
{
  "environment": {
    "VER": $VER,
    "PKG_CONFIG_PATH": "/usr/lib/libressl/pkgconfig"
  },
  "sources": [
    "https://git.sr.ht/~graywolf/acme-client-portable"
  ],
  "image": "archlinux",
  "packages": [
    "curl",
    "go",
    "libcap",
    "libressl",
    "nginx",
    "opendoas"
  ],
  "tasks": [
    {
      "doas":
        "echo 'permit nopass build' | sudo tee /etc/doas.conf"
    },
    {
      "setup-hosts":
        "cd acme-client-portable/_tools && ./setup-hosts"
    },
    {
      "setup-pebble":
        "cd acme-client-portable/_tools && ./setup-pebble"
    },
    {
      "fetch":
        "curl -SsflO https://data.wolfsden.cz/sources/acme-client-$VER.tar.gz"
    },
    {
      "extract":
        "tar -xvf acme-client-$VER.tar.gz"
    },
    {
      "configure":
        "cd acme-client-$VER && ./configure --enable-test-build --enable-libtls LDFLAGS='-Wl,-rpath /usr/lib/libressl'"
    },
    {
      "make":
        "cd acme-client-$VER && make"
    },
    {
      "make-check":
        "cd acme-client-$VER && make check"
    },
    {
      "make-distcheck":
        "cd acme-client-$VER && make LDFLAGS='-Wl,-rpath /usr/lib/libressl' distcheck"
    }
  ]
}
EOF
)"