test hosted version of go

This commit is contained in:
Sergey Dolin 2023-07-12 10:15:20 +02:00
parent 96a955403c
commit 60dde965e0
3 changed files with 27 additions and 9 deletions

View file

@ -1,4 +1,4 @@
name: Basic validation name: validate Windows installation
on: on:
push: push:
@ -16,7 +16,8 @@ jobs:
strategy: strategy:
matrix: matrix:
cache: [false, true] cache: [false, true]
go: [1.20.1] go: [1.20.1, 1.20.5]
name: 'Setup ${{ matrix.go }} cache: ${{ matrix.cache }}'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -26,6 +27,23 @@ jobs:
cache: ${{ matrix.cache }} cache: ${{ matrix.cache }}
name: v4-cache-${{ matrix.cache }} name: v4-cache-${{ matrix.cache }}
- run: |
if [ -e 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64' ];then
echo 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64 should not exist for hosted version of go';
exit 1
fi
du -m -s 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'
# make sure drive c: contains the folder
size=$(du -m -s 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t')
if [ $size -eq 0 ];then
echo 'Size of the hosted go installed on drive c: must be above zero'
exit 1
fi
shell: bash
name: Hosted go should not have link
if: ${{ matrix.go == '1.20.5' }}
- run: | - run: |
du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64' du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'
size=$(du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t') size=$(du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t')
@ -44,6 +62,7 @@ jobs:
fi fi
shell: bash shell: bash
name: Disk usage name: Disk usage
if: ${{ matrix.go != '1.20.5' }}
- run: | - run: |
echo $PATH echo $PATH
@ -54,8 +73,8 @@ jobs:
echo 'which go should return "/c/hostedtoolcache/windows/go/${{ matrix.go }}/x64/bin/go"' echo 'which go should return "/c/hostedtoolcache/windows/go/${{ matrix.go }}/x64/bin/go"'
exit 1 exit 1
fi fi
if [ $(go env GOROOT) != 'C:\hostedtoolcache\windows\go\1.20.1\x64' ];then if [ $(go env GOROOT) != 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64' ];then
echo 'go env GOROOT should return "C:\hostedtoolcache\windows\go\1.20.1\x64"' echo 'go env GOROOT should return "C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64"'
exit 1 exit 1
fi fi
shell: bash shell: bash

4
dist/setup/index.js vendored
View file

@ -61466,8 +61466,8 @@ function installGoVersion(info, auth, arch) {
} }
// for github hosted windows runner handle latency of OS drive // for github hosted windows runner handle latency of OS drive
// by avoiding write operations to C: // by avoiding write operations to C:
const isHosted = (process.env['RUNNER_ENVIRONMENT'] = 'github-hosted'); const isHosted = process.env['RUNNER_ENVIRONMENT'] === 'github-hosted';
if (isWindows && isHosted) { if (isWindows && isHosted && fs_1.default.existsSync('d:\\') && fs_1.default.existsSync('c:\\')) {
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'] || ''; const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
const substitutedToolCacheRoot = defaultToolCacheRoot const substitutedToolCacheRoot = defaultToolCacheRoot
.replace('C:', 'D:') .replace('C:', 'D:')

View file

@ -189,7 +189,6 @@ async function installGoVersion(
// Windows requires that we keep the extension (.zip) for extraction // Windows requires that we keep the extension (.zip) for extraction
const isWindows = os.platform() === 'win32'; const isWindows = os.platform() === 'win32';
const tempDir = process.env.RUNNER_TEMP || '.'; const tempDir = process.env.RUNNER_TEMP || '.';
const fileName = isWindows ? path.join(tempDir, info.fileName) : undefined; const fileName = isWindows ? path.join(tempDir, info.fileName) : undefined;
@ -204,8 +203,8 @@ async function installGoVersion(
// for github hosted windows runner handle latency of OS drive // for github hosted windows runner handle latency of OS drive
// by avoiding write operations to C: // by avoiding write operations to C:
const isHosted = (process.env['RUNNER_ENVIRONMENT'] = 'github-hosted'); const isHosted = process.env['RUNNER_ENVIRONMENT'] === 'github-hosted';
if (isWindows && isHosted) { if (isWindows && isHosted && fs.existsSync('d:\\') && fs.existsSync('c:\\')) {
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'] || ''; const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
const substitutedToolCacheRoot = defaultToolCacheRoot const substitutedToolCacheRoot = defaultToolCacheRoot
.replace('C:', 'D:') .replace('C:', 'D:')