Lint / JS (eslint) (push) Successful in 6s
Lint / Shell (shellcheck) (push) Successful in 8s
Lint / No secrets in webhook configs (push) Successful in 5s
Lint / No Hookshot webhook IDs in README (push) Successful in 4s
Lint / Python (ruff) (push) Successful in 4s
Lint / Landing page is rendered (matrix (push) Successful in 5s
Lint / Secret scan (gitleaks) (push) Successful in 6s
Lint / Python deps (pip-audit) (push) Successful in 36s
40 lines
1.5 KiB
Bash
40 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
# Build mautrix-discord with the Lotus patches in discord-bridge/patches/.
|
|
#
|
|
# Needs: git, Go (version from upstream go.mod or newer), a C compiler and libolm-dev.
|
|
# Output: ./mautrix-discord-lotus (dynamically linked against libolm.so.3, which
|
|
# LXC 151 has from the libolm3 package).
|
|
#
|
|
# Deploy (on the Proxmox node hosting LXC 151):
|
|
# pct push 151 mautrix-discord-lotus /opt/mautrix-discord/mautrix-discord.new
|
|
# pct exec 151 -- bash -c 'cd /opt/mautrix-discord && cp -a mautrix-discord mautrix-discord.bak-$(date +%Y%m%d) \
|
|
# && chown mautrix-discord: mautrix-discord.new && chmod 755 mautrix-discord.new \
|
|
# && mv mautrix-discord.new mautrix-discord && systemctl restart mautrix-discord'
|
|
set -euo pipefail
|
|
|
|
VERSION="${VERSION:-v0.7.7}"
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
OUT="${OUT:-$PWD/mautrix-discord-lotus}"
|
|
WORK="$(mktemp -d)"
|
|
trap 'rm -rf "$WORK"' EXIT
|
|
|
|
git clone -q --depth 1 --branch "$VERSION" https://github.com/mautrix/discord.git "$WORK/src"
|
|
cd "$WORK/src"
|
|
for p in "$HERE"/patches/*.patch; do
|
|
echo "applying $(basename "$p")"
|
|
git apply "$p"
|
|
done
|
|
|
|
go test -race -count=1 -run 'Retry|PreSend|Ambiguous|Echo' .
|
|
|
|
COMMIT="$(git rev-parse HEAD)"
|
|
MAUTRIX="$(go list -m -f '{{.Version}}' maunium.net/go/mautrix)"
|
|
CGO_ENABLED=1 go build -o "$OUT" -ldflags "-s -w \
|
|
-X main.Tag=$VERSION \
|
|
-X main.Commit=$COMMIT+lotus \
|
|
-X 'main.BuildTime=$(date '+%b %_d %Y, %H:%M:%S')' \
|
|
-X 'maunium.net/go/mautrix.GoModVersion=$MAUTRIX'" .
|
|
|
|
"$OUT" --version
|
|
echo "built $OUT"
|