From 05c2b60cc53e998a1e0119c089032d8e696fb59a Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Wed, 5 Apr 2023 14:49:04 +0200 Subject: [PATCH] helper to compile from source --- forgejo-test-helper.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/forgejo-test-helper.sh b/forgejo-test-helper.sh index 386602d..2394e7e 100755 --- a/forgejo-test-helper.sh +++ b/forgejo-test-helper.sh @@ -9,6 +9,36 @@ DIR=$(mktemp -d) trap "rm -fr $DIR" EXIT +function dependency_go() { + if ! which go > /dev/null ; then + apt-get update + apt-get install -y -qq wget tar + wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz + tar zxf go1.20.3.linux-amd64.tar.gz + export PATH=$PATH:$(pwd)/go/bin + fi +} + +function checkout() { + local git="$1" + if ! test -d forgejo-runner ; then + git clone $git forgejo-runner + fi +} + +function build() { + local git="$1" + local version="$2" + + ( + checkout "$git" + cd forgejo-runner + git checkout "$version" + make build + export PATH=$PATH:$(pwd) + ) +} + function api() { method=$1 shift