-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the precompiled 'gotip' on the xk6 workflow #4072
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8167e3e
Use the precompiled 'gotip' on the xk6 workflow
joanlopez 4b95a11
CI/xk6: Use 'matrix.platform' for 'runs-on'
joanlopez ee1f19c
Merge remote-tracking branch 'upstream/master' into gotip-xk6
joanlopez 655f91a
Workaround for Windows (PATH)
joanlopez 195520a
Merge remote-tracking branch 'upstream/master' into gotip-xk6
joanlopez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,20 +17,26 @@ 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 | ||
- 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" | ||
|
@@ -54,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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something I learned along the way, while working on this PR 💡 |
||
# 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" \ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we weren't using
matrix.platform
, so actually all the jobs were being executed on the same platform 😅I realized it, because when I tried to use the precompiled Go tip, it complained because the binary wasn't in the expected platform (e.g. a binary built for Windows, trying to be executed on Ubuntu, in this case haha)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!