@@ 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
+)"