-
Notifications
You must be signed in to change notification settings - Fork 889
chore: run test-go-pg on macOS and Windows in regular CI #17853
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
Merged
+247
−303
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fddaf7f
enable test-go-pg on macos and windows
hugodutka 0edcb08
enable go test cache in test-go-pg
hugodutka 010d50d
remove setup-imdisk
hugodutka 6e7cc86
remove nightly-gauntlet
hugodutka 09539ee
remove test-cli
hugodutka 2929c79
fix gen cancellation
hugodutka 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: "Setup Go Paths" | ||
description: Overrides Go paths like GOCACHE and GOMODCACHE to use temporary directories. | ||
outputs: | ||
gocache: | ||
description: "Value of GOCACHE" | ||
value: ${{ steps.paths.outputs.gocache }} | ||
gomodcache: | ||
description: "Value of GOMODCACHE" | ||
value: ${{ steps.paths.outputs.gomodcache }} | ||
gopath: | ||
description: "Value of GOPATH" | ||
value: ${{ steps.paths.outputs.gopath }} | ||
gotmp: | ||
description: "Value of GOTMPDIR" | ||
value: ${{ steps.paths.outputs.gotmp }} | ||
cached-dirs: | ||
description: "Go directories that should be cached between CI runs" | ||
value: ${{ steps.paths.outputs.cached-dirs }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Override Go paths | ||
id: paths | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 | ||
with: | ||
script: | | ||
const path = require('path'); | ||
|
||
// RUNNER_TEMP should be backed by a RAM disk on Windows if | ||
// coder/setup-ramdisk-action was used | ||
const runnerTemp = process.env.RUNNER_TEMP; | ||
const gocacheDir = path.join(runnerTemp, 'go-cache'); | ||
const gomodcacheDir = path.join(runnerTemp, 'go-mod-cache'); | ||
const gopathDir = path.join(runnerTemp, 'go-path'); | ||
const gotmpDir = path.join(runnerTemp, 'go-tmp'); | ||
|
||
core.exportVariable('GOCACHE', gocacheDir); | ||
core.exportVariable('GOMODCACHE', gomodcacheDir); | ||
core.exportVariable('GOPATH', gopathDir); | ||
core.exportVariable('GOTMPDIR', gotmpDir); | ||
|
||
core.setOutput('gocache', gocacheDir); | ||
core.setOutput('gomodcache', gomodcacheDir); | ||
core.setOutput('gopath', gopathDir); | ||
core.setOutput('gotmp', gotmpDir); | ||
|
||
const cachedDirs = `${gocacheDir}\n${gomodcacheDir}`; | ||
core.setOutput('cached-dirs', cachedDirs); | ||
|
||
- name: Create directories | ||
shell: bash | ||
run: | | ||
set -e | ||
mkdir -p "$GOCACHE" | ||
mkdir -p "$GOMODCACHE" | ||
mkdir -p "$GOPATH" | ||
mkdir -p "$GOTMPDIR" |
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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.
I don't mind using the script here, but you can accomplish the same with bash by echoing to
GITHUB_ENV
andGITHUB_OUTPUT
: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actionsThere 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.
I chose to use the script to handle setting multi-line env variables. With bash, you have to be very careful with whitespace and indentation. It's error-prone.