Skip to content

Commit 60dde96

Browse files
committed
test hosted version of go
1 parent 96a9554 commit 60dde96

3 files changed

Lines changed: 27 additions & 9 deletions

File tree

.github/workflows/windows-validation.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Basic validation
1+
name: validate Windows installation
22

33
on:
44
push:
@@ -16,7 +16,8 @@ jobs:
1616
strategy:
1717
matrix:
1818
cache: [false, true]
19-
go: [1.20.1]
19+
go: [1.20.1, 1.20.5]
20+
name: 'Setup ${{ matrix.go }} cache: ${{ matrix.cache }}'
2021
steps:
2122
- uses: actions/checkout@v3
2223

@@ -26,6 +27,23 @@ jobs:
2627
cache: ${{ matrix.cache }}
2728
name: v4-cache-${{ matrix.cache }}
2829

30+
- run: |
31+
if [ -e 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64' ];then
32+
echo 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64 should not exist for hosted version of go';
33+
exit 1
34+
fi
35+
36+
du -m -s 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'
37+
# make sure drive c: contains the folder
38+
size=$(du -m -s 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t')
39+
if [ $size -eq 0 ];then
40+
echo 'Size of the hosted go installed on drive c: must be above zero'
41+
exit 1
42+
fi
43+
shell: bash
44+
name: Hosted go should not have link
45+
if: ${{ matrix.go == '1.20.5' }}
46+
2947
- run: |
3048
du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'
3149
size=$(du -m -s 'D:\hostedtoolcache\windows\go\${{ matrix.go }}\x64'|cut -f1 -d$'\t')
@@ -44,6 +62,7 @@ jobs:
4462
fi
4563
shell: bash
4664
name: Disk usage
65+
if: ${{ matrix.go != '1.20.5' }}
4766
4867
- run: |
4968
echo $PATH
@@ -54,8 +73,8 @@ jobs:
5473
echo 'which go should return "/c/hostedtoolcache/windows/go/${{ matrix.go }}/x64/bin/go"'
5574
exit 1
5675
fi
57-
if [ $(go env GOROOT) != 'C:\hostedtoolcache\windows\go\1.20.1\x64' ];then
58-
echo 'go env GOROOT should return "C:\hostedtoolcache\windows\go\1.20.1\x64"'
76+
if [ $(go env GOROOT) != 'C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64' ];then
77+
echo 'go env GOROOT should return "C:\hostedtoolcache\windows\go\${{ matrix.go }}\x64"'
5978
exit 1
6079
fi
6180
shell: bash

dist/setup/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61466,8 +61466,8 @@ function installGoVersion(info, auth, arch) {
6146661466
}
6146761467
// for github hosted windows runner handle latency of OS drive
6146861468
// by avoiding write operations to C:
61469-
const isHosted = (process.env['RUNNER_ENVIRONMENT'] = 'github-hosted');
61470-
if (isWindows && isHosted) {
61469+
const isHosted = process.env['RUNNER_ENVIRONMENT'] === 'github-hosted';
61470+
if (isWindows && isHosted && fs_1.default.existsSync('d:\\') && fs_1.default.existsSync('c:\\')) {
6147161471
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
6147261472
const substitutedToolCacheRoot = defaultToolCacheRoot
6147361473
.replace('C:', 'D:')

src/installer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ async function installGoVersion(
189189

190190
// Windows requires that we keep the extension (.zip) for extraction
191191
const isWindows = os.platform() === 'win32';
192-
193192
const tempDir = process.env.RUNNER_TEMP || '.';
194193
const fileName = isWindows ? path.join(tempDir, info.fileName) : undefined;
195194

@@ -204,8 +203,8 @@ async function installGoVersion(
204203

205204
// for github hosted windows runner handle latency of OS drive
206205
// by avoiding write operations to C:
207-
const isHosted = (process.env['RUNNER_ENVIRONMENT'] = 'github-hosted');
208-
if (isWindows && isHosted) {
206+
const isHosted = process.env['RUNNER_ENVIRONMENT'] === 'github-hosted';
207+
if (isWindows && isHosted && fs.existsSync('d:\\') && fs.existsSync('c:\\')) {
209208
const defaultToolCacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
210209
const substitutedToolCacheRoot = defaultToolCacheRoot
211210
.replace('C:', 'D:')

0 commit comments

Comments
 (0)