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