From 8b95f2b5d21eed2286b92f256f656c48e1eafbe2 Mon Sep 17 00:00:00 2001 From: Jeremie Fraeys Date: Thu, 12 Feb 2026 13:39:14 -0500 Subject: [PATCH] ci: use fast Go setup that skips download if already installed --- .forgejo/workflows/ci-native.yml | 40 ++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/ci-native.yml b/.forgejo/workflows/ci-native.yml index fb7f41b..e6f28c4 100644 --- a/.forgejo/workflows/ci-native.yml +++ b/.forgejo/workflows/ci-native.yml @@ -105,9 +105,22 @@ jobs: fetch-depth: 1 - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: '1.25' + run: | + REQUIRED_GO="1.25" + if command -v go &> /dev/null && go version | grep -q "go${REQUIRED_GO}"; then + echo "Go ${REQUIRED_GO} already installed - skipping download" + else + echo "Installing Go ${REQUIRED_GO}..." + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + curl -sL "https://go.dev/dl/go${REQUIRED_GO}.linux-amd64.tar.gz" | sudo tar -C /usr/local -xzf - + elif [[ "$OSTYPE" == "darwin"* ]]; then + curl -sL "https://go.dev/dl/go${REQUIRED_GO}.darwin-amd64.tar.gz" | sudo tar -C /usr/local -xzf - + fi + export PATH="/usr/local/go/bin:$PATH" + echo "/usr/local/go/bin" >> $GITHUB_PATH + echo "Go ${REQUIRED_GO} installed" + fi + go version - name: Build Native Libraries run: | @@ -168,10 +181,23 @@ jobs: with: fetch-depth: 1 - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: '1.25' + - name: Setup Go (fast) + run: | + REQUIRED_GO="1.25" + if command -v go &> /dev/null && go version | grep -q "go${REQUIRED_GO}"; then + echo "Go ${REQUIRED_GO} already installed - skipping download" + else + echo "Installing Go ${REQUIRED_GO}..." + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + curl -sL "https://go.dev/dl/go${REQUIRED_GO}.linux-amd64.tar.gz" | sudo tar -C /usr/local -xzf - + elif [[ "$OSTYPE" == "darwin"* ]]; then + curl -sL "https://go.dev/dl/go${REQUIRED_GO}.darwin-amd64.tar.gz" | sudo tar -C /usr/local -xzf - + fi + export PATH="/usr/local/go/bin:$PATH" + echo "/usr/local/go/bin" >> $GITHUB_PATH + echo "Go ${REQUIRED_GO} installed" + fi + go version - name: Build Release Libraries run: |