Files
setup-go/__tests__/windows-toolcache.test.ts
Kai 0948bf67a8
Validate Microsoft build of Go / Microsoft build of Go 1.24 on macos-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go 1.24 on windows-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go 1.25 on macos-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go 1.25 on ubuntu-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go 1.25 on windows-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go via env var on macos-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go via env var on ubuntu-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go via env var on windows-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go arch arm64 on macos-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go arch x64 on macos-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go arch x64 on ubuntu-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go with caching on macos-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go with caching on ubuntu-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go with caching on windows-latest (push) Canceled after 0s
Validate Microsoft build of Go / Microsoft build of Go 1.24 on ubuntu-latest (push) Canceled after 3s
Validate 'setup-go' / stable (macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / stable (macos-latest) (push) Canceled after 0s
Validate 'setup-go' / stable (windows-latest) (push) Canceled after 0s
Validate 'setup-go' / oldstable (macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / oldstable (macos-latest) (push) Canceled after 0s
Validate 'setup-go' / oldstable (ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / oldstable (windows-latest) (push) Canceled after 0s
Validate 'setup-go' / go-env-outputs (macos-latest) (push) Canceled after 0s
Validate 'setup-go' / go-env-outputs (ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / go-env-outputs (windows-latest) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, oldstable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, stable) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.21, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x32, windows-latest, oldstable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x32, windows-latest, stable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, macos-15-intel, oldstable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, macos-15-intel, stable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, macos-latest, oldstable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, macos-latest, stable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, oldstable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, stable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, windows-latest, oldstable) (push) Canceled after 0s
Validate 'setup-go' / aliases-arch (x64, windows-latest, stable) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.20.14, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.21.13, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.21.13, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.21.13, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.21.13, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.22.8, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.22.8, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.22.8, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.22.8, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.23.2, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.23.2, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / Setup local-cache version (1.23.2, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.20, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.20, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.20, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.20, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.21, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.21, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.21, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.22, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / stable (ubuntu-latest) (push) Canceled after 3s
Validate 'setup-go' / check-latest (1.22, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.22, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.22, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.23, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.23, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.23, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / check-latest (1.23, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file (macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / go-version-file (macos-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file (ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file (windows-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-gowork (macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-gowork (macos-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-gowork (ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-gowork (windows-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-tool-versions (macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-tool-versions (macos-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-tool-versions (ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-tool-versions (windows-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-go-version (macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-go-version (macos-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-go-version (ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / go-version-file-with-go-version (windows-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-dist (1.11.12, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-dist (1.11.12, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (arm64, 1.20.14, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (arm64, 1.22, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (arm64, 1.23, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.20.14, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.20.14, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.21, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.21, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.21, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.20.14, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.21.10, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.22.8, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-manifest (1.23.2, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / setup-versions-from-dist (1.11.12, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / architecture (arm64, 1.21, macos-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.20.14, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.22, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.22, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.23, macos-15-intel) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.22, windows-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.23, ubuntu-latest) (push) Canceled after 0s
Validate 'setup-go' / architecture (x64, 1.23, windows-latest) (push) Canceled after 0s
Validate Windows installation / Validate if symlink is created (false, 1.20.1) (push) Canceled after 0s
Validate Windows installation / Validate if symlink is created (true, 1.20.1) (push) Canceled after 0s
Validate Windows installation / Find default go version (push) Canceled after 0s
Validate Windows installation / Validate if symlink is not created for default go (false) (push) Canceled after 0s
Validate Windows installation / Validate if symlink is not created for default go (true) (push) Canceled after 0s
Validate Windows installation / Validate if hostedtoolcache works as expected (false, 1.20.1) (push) Canceled after 0s
first commit
2026-10-30 14:19:38 +08:00

82 lines
2.7 KiB
TypeScript

import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
import path from 'path';
const statSyncMock = jest.fn(() => ({
isDirectory: () => true,
isFile: () => true
}));
const readdirSyncMock = jest.fn(() => [] as any);
const writeFileSyncMock = jest.fn();
const mkdirMock = jest.fn();
const symlinkSyncMock = jest.fn();
jest.unstable_mockModule('@actions/io', () => ({
which: jest.fn(),
mkdirP: jest.fn(() => Promise.resolve()),
rmRF: jest.fn(() => Promise.resolve()),
mv: jest.fn(() => Promise.resolve()),
cp: jest.fn(() => Promise.resolve())
}));
const realFs = (await import('fs')).default;
const fsExports = {
...realFs,
statSync: statSyncMock,
readdirSync: readdirSyncMock,
writeFileSync: writeFileSyncMock,
mkdir: mkdirMock,
symlinkSync: symlinkSyncMock
};
jest.unstable_mockModule('fs', () => ({...fsExports, default: fsExports}));
const io = await import('@actions/io');
const tc = await import('@actions/tool-cache');
describe('Windows performance workaround', () => {
let rmRFSpy: jest.Mock;
let mkdirPSpy: jest.Mock;
let cpSpy: jest.Mock;
let runnerToolCache: string | undefined;
beforeEach(() => {
rmRFSpy = io.rmRF as jest.Mock;
mkdirPSpy = io.mkdirP as jest.Mock;
cpSpy = io.cp as jest.Mock;
// default implementations
statSyncMock.mockImplementation(() => ({
isDirectory: () => true,
isFile: () => true
}));
readdirSyncMock.mockImplementation(() => []);
writeFileSyncMock.mockImplementation(() => {});
mkdirMock.mockImplementation(() => {});
symlinkSyncMock.mockImplementation(() => {});
rmRFSpy.mockImplementation(() => Promise.resolve());
mkdirPSpy.mockImplementation(() => Promise.resolve());
cpSpy.mockImplementation(() => Promise.resolve());
runnerToolCache = process.env['RUNNER_TOOL_CACHE'];
});
afterEach(() => {
jest.clearAllMocks();
process.env['RUNNER_TOOL_CACHE'] = runnerToolCache;
});
// cacheWindowsToolkitDir depends on implementation of tc.cacheDir
// with the assumption that target dir is passed by RUNNER_TOOL_CACHE environment variable
// Make sure the implementation has not been changed
it('addExecutablesToCache should depend on env[RUNNER_TOOL_CACHE]', async () => {
process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache1';
const cacheDir1 = await tc.cacheDir('/qzx', 'go', '1.2.3', 'arch');
expect(cacheDir1).toBe(
path.join('/', 'faked-hostedtoolcache1', 'go', '1.2.3', 'arch')
);
process.env['RUNNER_TOOL_CACHE'] = '/faked-hostedtoolcache2';
const cacheDir2 = await tc.cacheDir('/qzx', 'go', '1.2.3', 'arch');
expect(cacheDir2).toBe(
path.join('/', 'faked-hostedtoolcache2', 'go', '1.2.3', 'arch')
);
});
});