mirror of
https://github.com/actions/setup-go.git
synced 2026-03-16 18:15:19 +00:00
Some checks failed
Basic validation / Basic validation (push) Failing after 0s
Check dist/ / Check dist/ (push) Failing after 0s
Licensed / Licensed (push) Failing after 0s
Validate Windows installation / Validate if symlink is created (false, 1.20.1) (push) Has been cancelled
Validate Windows installation / Validate if symlink is created (true, 1.20.1) (push) Has been cancelled
Validate Windows installation / Find default go version (push) Has been cancelled
Validate Windows installation / Validate if hostedtoolcache works as expected (false, 1.20.1) (push) Has been cancelled
Validate Windows installation / Validate if symlink is not created for default go (false) (push) Has been cancelled
Validate Windows installation / Validate if symlink is not created for default go (true) (push) Has been cancelled
Update configuration files / Update configuration files (push) Failing after 0s
CodeQL analysis / CodeQL analysis (push) Failing after 0s
Validate 'setup-go' / stable (ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / oldstable (ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, stable) (push) Failing after 4s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, stable) (push) Failing after 4s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, oldstable) (push) Failing after 4s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, oldstable) (push) Failing after 4s
Validate 'setup-go' / Setup local-cache version (1.22.8, ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / Setup local-cache version (1.21.13, ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / Setup local-cache version (1.23.2, ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / check-latest (1.20, ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / check-latest (1.22, ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / check-latest (1.21, ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / go-version-file (ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / check-latest (1.23, ubuntu-latest) (push) Failing after 4s
Validate 'setup-go' / go-version-file-with-tool-versions (ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / go-version-file-with-gowork (ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / go-version-file-with-go-version (ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / setup-versions-from-dist (1.11.12, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / architecture (x64, 1.20.14, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / architecture (x64, 1.21, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / architecture (x64, 1.22, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / architecture (x64, 1.23, ubuntu-latest) (push) Failing after 3s
Validate 'setup-go' / stable (macos-latest) (push) Has been cancelled
Validate 'setup-go' / stable (macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / stable (windows-latest) (push) Has been cancelled
Validate 'setup-go' / oldstable (macos-latest) (push) Has been cancelled
Validate 'setup-go' / oldstable (macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / oldstable (windows-latest) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x64, macos-latest-large, oldstable) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x32, windows-latest, oldstable) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x32, windows-latest, stable) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x64, macos-latest, oldstable) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x64, macos-latest, stable) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.21.13, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x64, macos-latest-large, stable) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x64, windows-latest, oldstable) (push) Has been cancelled
Validate 'setup-go' / aliases-arch (x64, windows-latest, stable) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.20.14, windows-latest) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.21.13, macos-latest) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.21.13, windows-latest) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.22.8, macos-latest) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.22.8, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.22.8, windows-latest) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.23.2, macos-latest) (push) Has been cancelled
Validate 'setup-go' / Setup local-cache version (1.23.2, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / go-version-file (macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / go-version-file (windows-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-gowork (macos-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-gowork (macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-tool-versions (windows-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-go-version (macos-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-go-version (macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, macos-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, windows-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, windows-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.20, macos-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.20, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.20, windows-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.21, macos-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.21, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.21, windows-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.22, macos-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.22, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.22, windows-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.23, macos-latest) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.23, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / check-latest (1.23, windows-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file (macos-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-gowork (windows-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-tool-versions (macos-latest) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-tool-versions (macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / go-version-file-with-go-version (windows-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, windows-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, macos-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, macos-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, macos-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, windows-latest) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-dist (1.11.12, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / setup-versions-from-dist (1.11.12, windows-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (arm64, 1.20.14, macos-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.21, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.22, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.22, windows-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.23, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.23, windows-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (arm64, 1.21, macos-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (arm64, 1.22, macos-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (arm64, 1.23, macos-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.20.14, macos-latest-large) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.20.14, windows-latest) (push) Has been cancelled
Validate 'setup-go' / architecture (x64, 1.21, windows-latest) (push) Has been cancelled
* Update module cache to use go.mod as key * Fix typo * Revise breaking changes in README for V6 Updated breaking changes section with enhanced formatting and clarified toolchain management details.
67 lines
2.1 KiB
TypeScript
67 lines
2.1 KiB
TypeScript
import * as cache from '@actions/cache';
|
|
import * as core from '@actions/core';
|
|
import * as glob from '@actions/glob';
|
|
import path from 'path';
|
|
import fs from 'fs';
|
|
|
|
import {State, Outputs} from './constants';
|
|
import {PackageManagerInfo} from './package-managers';
|
|
import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils';
|
|
|
|
export const restoreCache = async (
|
|
versionSpec: string,
|
|
packageManager: string,
|
|
cacheDependencyPath?: string
|
|
) => {
|
|
const packageManagerInfo = await getPackageManagerInfo(packageManager);
|
|
const platform = process.env.RUNNER_OS;
|
|
const arch = process.arch;
|
|
|
|
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
|
|
|
|
const dependencyFilePath = cacheDependencyPath
|
|
? cacheDependencyPath
|
|
: findDependencyFile(packageManagerInfo);
|
|
const fileHash = await glob.hashFiles(dependencyFilePath);
|
|
|
|
if (!fileHash) {
|
|
throw new Error(
|
|
'Some specified paths were not resolved, unable to cache dependencies.'
|
|
);
|
|
}
|
|
|
|
const linuxVersion =
|
|
process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : '';
|
|
const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`;
|
|
core.debug(`primary key is ${primaryKey}`);
|
|
|
|
core.saveState(State.CachePrimaryKey, primaryKey);
|
|
|
|
const cacheKey = await cache.restoreCache(cachePaths, primaryKey);
|
|
core.setOutput(Outputs.CacheHit, Boolean(cacheKey));
|
|
|
|
if (!cacheKey) {
|
|
core.info(`Cache is not found`);
|
|
core.setOutput(Outputs.CacheHit, false);
|
|
return;
|
|
}
|
|
|
|
core.saveState(State.CacheMatchedKey, cacheKey);
|
|
core.info(`Cache restored from key: ${cacheKey}`);
|
|
};
|
|
|
|
const findDependencyFile = (packageManager: PackageManagerInfo) => {
|
|
const dependencyFile = packageManager.dependencyFilePattern;
|
|
const workspace = process.env.GITHUB_WORKSPACE!;
|
|
const rootContent = fs.readdirSync(workspace);
|
|
|
|
const goModFileExists = rootContent.includes(dependencyFile);
|
|
if (!goModFileExists) {
|
|
throw new Error(
|
|
`Dependencies file is not found in ${workspace}. Supported file pattern: ${dependencyFile}`
|
|
);
|
|
}
|
|
|
|
return path.join(workspace, dependencyFile);
|
|
};
|