From 8167e3e9ad03d9490f1485ed817a77fd3c21117f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20L=C3=B3pez=20de=20la=20Franca=20Beltran?= Date: Mon, 18 Nov 2024 14:57:02 +0100 Subject: [PATCH 1/3] Use the precompiled 'gotip' on the xk6 workflow --- .github/workflows/xk6.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/xk6.yml b/.github/workflows/xk6.yml index cd5bbb5c8bb..1000eabf43c 100644 --- a/.github/workflows/xk6.yml +++ b/.github/workflows/xk6.yml @@ -22,15 +22,21 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - name: Install Go + if: matrix.go != 'tip' uses: actions/setup-go@v5 with: go-version: 1.23.x check-latest: true + - name: Download Go tip + if: matrix.go == 'tip' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release download ${{ matrix.platform }} --repo grafana/gotip --pattern 'go.zip' - name: Install Go tip if: matrix.go == 'tip' run: | - go install golang.org/dl/gotip@latest - gotip download + unzip go.zip -d $HOME/sdk echo "GOROOT=$HOME/sdk/gotip" >> "$GITHUB_ENV" echo "GOPATH=$HOME/go" >> "$GITHUB_ENV" echo "$HOME/go/bin" >> "$GITHUB_PATH" From 4b95a11be2110aa6ff28592900664bcac935e2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20L=C3=B3pez=20de=20la=20Franca=20Beltran?= Date: Tue, 19 Nov 2024 10:05:49 +0100 Subject: [PATCH 2/3] CI/xk6: Use 'matrix.platform' for 'runs-on' --- .github/workflows/xk6.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/xk6.yml b/.github/workflows/xk6.yml index 1000eabf43c..b879f37fb53 100644 --- a/.github/workflows/xk6.yml +++ b/.github/workflows/xk6.yml @@ -17,7 +17,7 @@ jobs: matrix: go: [stable, tip] platform: [ubuntu-latest, windows-2019, macos-latest] - runs-on: ubuntu-latest + runs-on: ${{ matrix.platform }} steps: - name: Checkout code uses: actions/checkout@v4 From 655f91af3f689e9254e17cadd6cb62f647d430d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20L=C3=B3pez=20de=20la=20Franca=20Beltran?= Date: Tue, 19 Nov 2024 13:03:28 +0100 Subject: [PATCH 3/3] Workaround for Windows (PATH) --- .github/workflows/xk6.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/xk6.yml b/.github/workflows/xk6.yml index b879f37fb53..6b0ab2744fc 100644 --- a/.github/workflows/xk6.yml +++ b/.github/workflows/xk6.yml @@ -60,6 +60,13 @@ jobs: "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]; then export XK6_K6_REPO="github.com/${{ github.event.pull_request.head.repo.full_name }}" fi + # The following is a workaround for Windows, cause when using 'shell: bash', the PATH is expressed + # with ':' as separator, but Go code, running on a Windows OS, expects ';' as separator. + XPATH="$PATH" + if [[ "${{ matrix.platform }}" == "windows-latest" || "${{ matrix.platform }}" == "windows-2019" ]]; then + XPATH="$HOME/sdk/gotip/bin;$XPATH" + fi + PATH="$XPATH" \ GOPRIVATE="go.k6.io/k6" xk6 build "$COMMIT_ID" \ --output ./k6ext \ --with github.com/grafana/xk6-js-test="$(pwd)/xk6-js-test" \