Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugodutka merged 6 commits intomainfromhugodutka/test-go-pg-windows-macos-cache
May 22, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions.github/actions/setup-go-paths/action.yml
View file
Open in desktop
Original file line numberDiff line numberDiff 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: |
Copy link
Member

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 toGITHUB_ENV andGITHUB_OUTPUT:https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions

Copy link
ContributorAuthor

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.

deansheather reacted with thumbs up emoji
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"
32 changes: 8 additions & 24 deletions.github/actions/setup-go/action.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,42 +8,26 @@ inputs:
use-preinstalled-go:
description: "Whether to use preinstalled Go."
default: "false"
use-temp-cache-dirs:
description: "Whether to usetemporary GOCACHE and GOMODCACHE directories."
default: "false"
use-cache:
description: "Whether to usethe cache."
default: "true"
runs:
using: "composite"
steps:
- name: Override GOCACHE and GOMODCACHE
shell: bash
if: inputs.use-temp-cache-dirs == 'true'
run: |
# cd to another directory to ensure we're not inside a Go project.
# That'd trigger Go to download the toolchain for that project.
cd "$RUNNER_TEMP"
# RUNNER_TEMP should be backed by a RAM disk on Windows if
# coder/setup-ramdisk-action was used
export GOCACHE_DIR="$RUNNER_TEMP""\go-cache"
export GOMODCACHE_DIR="$RUNNER_TEMP""\go-mod-cache"
export GOPATH_DIR="$RUNNER_TEMP""\go-path"
export GOTMP_DIR="$RUNNER_TEMP""\go-tmp"
mkdir -p "$GOCACHE_DIR"
mkdir -p "$GOMODCACHE_DIR"
mkdir -p "$GOPATH_DIR"
mkdir -p "$GOTMP_DIR"
go env -w GOCACHE="$GOCACHE_DIR"
go env -w GOMODCACHE="$GOMODCACHE_DIR"
go env -w GOPATH="$GOPATH_DIR"
go env -w GOTMPDIR="$GOTMP_DIR"
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ inputs.use-preinstalled-go == 'false' && inputs.version || '' }}
cache: ${{ inputs.use-cache }}

- name: Install gotestsum
shell: bash
run: go install gotest.tools/gotestsum@0d9599e513d70e5792bb9334869f82f6e8b53d4d # main as of 2025-05-15

- name: Install mtimehash
shell: bash
run: go install github.com/slsyy/mtimehash/cmd/mtimehash@a6b5da4ed2c4a40e7b805534b004e9fde7b53ce0 # v1.0.0

# It isn't necessary that we ever do this, but it helps
# separate the "setup" from the "run" times.
- name: go mod download
Expand Down
27 changes: 0 additions & 27 deletions.github/actions/setup-imdisk/action.yaml
View file
Open in desktop

This file was deleted.

Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp