mirror of
https://github.com/actions/setup-go.git
synced 2026-02-21 22:25:03 +08:00
Compare commits
19 Commits
v5.3.0
...
1cde715135
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cde715135 | ||
|
|
fdd38598b9 | ||
|
|
5a083d0e9a | ||
|
|
1d82324e53 | ||
|
|
bda02de888 | ||
|
|
be775566d4 | ||
|
|
5b1dffca1b | ||
|
|
e91efc513b | ||
|
|
e3c077dd6d | ||
|
|
f8cf508b5f | ||
|
|
c8eefa5dde | ||
|
|
896e2cbf0f | ||
|
|
fd3fcb34ee | ||
|
|
6cd0eaadd6 | ||
|
|
0dc6404f6a | ||
|
|
434fb17078 | ||
|
|
97e00a50c1 | ||
|
|
0859a18f70 | ||
|
|
28b19b8019 |
37
.github/workflows/windows-validation.yml
vendored
37
.github/workflows/windows-validation.yml
vendored
@@ -134,3 +134,40 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: ${{ matrix.cache }}
|
||||
|
||||
go-mod-cache-and-tmp-location:
|
||||
name: 'Validate if GOCACHE, GOMODCACHE, GOTMPDIR is set to drive D:'
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
cache: [false]
|
||||
go: [1.20.1]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 'Setup ${{ matrix.go }}, cache: ${{ matrix.cache }}'
|
||||
uses: ./
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: ${{ matrix.cache }}
|
||||
|
||||
- name: 'Check if go mod cache and tmp location is set correctly'
|
||||
run: |
|
||||
go env GOCACHE
|
||||
go env GOMODCACHE
|
||||
go env GOTMPDIR
|
||||
|
||||
if [ $(go env GOCACHE) != 'D:\Users\runneradmin\AppData\Local\go-build' ];then
|
||||
echo 'go env GOCACHE should return "D:\Users\runneradmin\AppData\Local\go-build"'
|
||||
exit 1
|
||||
fi
|
||||
if [ $(go env GOMODCACHE) != 'D:\Users\runneradmin\go\pkg\mod' ];then
|
||||
echo 'go env GOMODCACHE should return "D:\Users\runneradmin\go\pkg\mod"'
|
||||
exit 1
|
||||
fi
|
||||
if [ $(go env GOTMPDIR) != 'D:\gotmp' ];then
|
||||
echo 'go env GOTMPDIR should return "D:\gotmp"'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shell: bash
|
||||
|
||||
26
.licenses/npm/lru-cache.dep.yml
generated
26
.licenses/npm/lru-cache.dep.yml
generated
@@ -1,26 +0,0 @@
|
||||
---
|
||||
name: lru-cache
|
||||
version: 6.0.0
|
||||
type: npm
|
||||
summary: A cache object that deletes the least-recently-used items.
|
||||
homepage:
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: semver
|
||||
version: 7.6.0
|
||||
version: 7.6.3
|
||||
type: npm
|
||||
summary: The semantic version parser used by npm.
|
||||
homepage:
|
||||
26
.licenses/npm/yallist.dep.yml
generated
26
.licenses/npm/yallist.dep.yml
generated
@@ -1,26 +0,0 @@
|
||||
---
|
||||
name: yallist
|
||||
version: 4.0.0
|
||||
type: npm
|
||||
summary: Yet Another Linked List
|
||||
homepage:
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
||||
921
dist/setup/index.js
vendored
921
dist/setup/index.js
vendored
File diff suppressed because it is too large
Load Diff
42
package-lock.json
generated
42
package-lock.json
generated
@@ -10,13 +10,13 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.0.0",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/glob": "^0.4.0",
|
||||
"@actions/http-client": "^2.2.1",
|
||||
"@actions/io": "^1.0.2",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"semver": "^7.6.0"
|
||||
"semver": "^7.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.12",
|
||||
@@ -26,7 +26,7 @@
|
||||
"@typescript-eslint/parser": "^5.54.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-jest": "^27.9.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"jest": "^29.7.0",
|
||||
@@ -96,6 +96,7 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
|
||||
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
}
|
||||
@@ -2891,12 +2892,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-config-prettier": {
|
||||
"version": "8.10.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz",
|
||||
"integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==",
|
||||
"version": "10.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.0.1.tgz",
|
||||
"integrity": "sha512-lZBts941cyJyeaooiKxAtzoPHTN+GbQTJFAIdQbRhA4/8whaAraEh47Whw/ZFfrjNSnlAxqfm9i0XVAEkULjCw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"eslint-config-prettier": "bin/cli.js"
|
||||
"eslint-config-prettier": "build/bin/cli.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": ">=7.0.0"
|
||||
@@ -5442,12 +5443,9 @@
|
||||
"integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.6.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
|
||||
"integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"version": "7.6.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
|
||||
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
@@ -5455,22 +5453,6 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/semver/node_modules/lru-cache": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
||||
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
||||
"dependencies": {
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/semver/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
"node_modules/set-function-length": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
|
||||
|
||||
10
package.json
10
package.json
@@ -26,13 +26,13 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.0.0",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/glob": "^0.4.0",
|
||||
"@actions/http-client": "^2.2.1",
|
||||
"@actions/io": "^1.0.2",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"semver": "^7.6.0"
|
||||
"semver": "^7.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.12",
|
||||
@@ -42,7 +42,7 @@
|
||||
"@typescript-eslint/parser": "^5.54.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-jest": "^27.9.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"jest": "^29.7.0",
|
||||
@@ -52,4 +52,4 @@
|
||||
"ts-jest": "^29.1.2",
|
||||
"typescript": "^5.4.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,14 @@ import * as glob from '@actions/glob';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
import {State, Outputs} from './constants';
|
||||
import {Outputs, State} from './constants';
|
||||
import {PackageManagerInfo} from './package-managers';
|
||||
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
|
||||
import {
|
||||
getCacheDirectoryPath,
|
||||
getCommandOutput,
|
||||
getPackageManagerInfo
|
||||
} from './cache-utils';
|
||||
import os from 'os';
|
||||
|
||||
export const restoreCache = async (
|
||||
versionSpec: string,
|
||||
@@ -50,6 +55,53 @@ export const restoreCache = async (
|
||||
core.info(`Cache restored from key: ${cacheKey}`);
|
||||
};
|
||||
|
||||
export const setWindowsCacheDirectories = async () => {
|
||||
if (os.platform() !== 'win32') return;
|
||||
|
||||
let goCache = await getCommandOutput(`go env GOCACHE`);
|
||||
core.info(`GOCACHE: ${goCache}`);
|
||||
goCache = goCache.replace('C:', 'D:').replace('c:', 'd:');
|
||||
|
||||
if (!fs.existsSync(goCache)) {
|
||||
core.info(`${goCache} does not exist. Creating`);
|
||||
fs.mkdirSync(goCache, {recursive: true});
|
||||
}
|
||||
|
||||
const setOutput = await getCommandOutput(`go env -w GOCACHE=${goCache}`);
|
||||
core.info(`go env -w GOCACHE output: ${setOutput}`);
|
||||
|
||||
let goModCache = await getCommandOutput(`go env GOMODCACHE`);
|
||||
core.info(`GOMODCACHE: ${goModCache}`);
|
||||
goModCache = goModCache.replace('C:', 'D:').replace('c:', 'd:');
|
||||
|
||||
if (!fs.existsSync(goModCache)) {
|
||||
core.info(`${goModCache} does not exist. Creating`);
|
||||
fs.mkdirSync(goModCache, {recursive: true});
|
||||
}
|
||||
|
||||
const setModOutput = await getCommandOutput(
|
||||
`go env -w GOMODCACHE=${goModCache}`
|
||||
);
|
||||
core.info(`go env -w GOMODCACHE output: ${setModOutput}`);
|
||||
|
||||
let goTmpDir = await getCommandOutput(`go env GOTMPDIR`);
|
||||
core.info(`GOTMPDIR: ${goTmpDir}`);
|
||||
if (!goTmpDir || goTmpDir === '') {
|
||||
goTmpDir = 'D:\\gotmp';
|
||||
}
|
||||
goTmpDir = goTmpDir.replace('C:', 'D:').replace('c:', 'd:');
|
||||
|
||||
if (!fs.existsSync(goTmpDir)) {
|
||||
core.info(`${goTmpDir} does not exist. Creating`);
|
||||
fs.mkdirSync(goTmpDir, {recursive: true});
|
||||
}
|
||||
|
||||
const setGoTmpOutput = await getCommandOutput(
|
||||
`go env -w GOTMPDIR=${goTmpDir}`
|
||||
);
|
||||
core.info(`go env -w GOTMPDIR output: ${setGoTmpOutput}`);
|
||||
};
|
||||
|
||||
const findDependencyFile = (packageManager: PackageManagerInfo) => {
|
||||
const dependencyFile = packageManager.dependencyFilePattern;
|
||||
const workspace = process.env.GITHUB_WORKSPACE!;
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as io from '@actions/io';
|
||||
import * as installer from './installer';
|
||||
import * as semver from 'semver';
|
||||
import path from 'path';
|
||||
import {restoreCache} from './cache-restore';
|
||||
import {restoreCache, setWindowsCacheDirectories} from './cache-restore';
|
||||
import {isCacheFeatureAvailable} from './cache-utils';
|
||||
import cp from 'child_process';
|
||||
import fs from 'fs';
|
||||
@@ -11,6 +11,7 @@ import os from 'os';
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
await setWindowsCacheDirectories();
|
||||
//
|
||||
// versionSpec is optional. If supplied, install / use from the tool cache
|
||||
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
|
||||
|
||||
Reference in New Issue
Block a user