-
Notifications
You must be signed in to change notification settings - Fork 1
171 lines (157 loc) · 4.96 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
defaults:
run:
shell: bash
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check
run: |
perl -V
perl -c install-go.pl
- name: Environment
run: |
env | sort
- name: Test GOROOT version
run: |
version=$(echo "$GOROOT" | perl -nE '/(\d+.\d+.\d+)/ and say $1')
if [ -n "$version" ]; then
mkdir xxx
./install-go.pl -p -e $version xxx
./xxx/go/bin/go version | tee xxx/go-version
fgrep -q go$version xxx/go-version
if [ -s "$GITHUB_PATH" ]; then
echo "*** GITHUB_PATH file altered:"
cat $GITHUB_PATH
echo "--------------------"
false
fi
if [ -s "$GITHUB_ENV" ]; then
echo "*** GITHUB_ENV file altered:"
cat $GITHUB_ENV
echo "--------------------"
false
fi
chmod -R u+w xxx
rm -rf xxx
elif [ -z "$GOROOT" ]; then
echo "GOROOT not available in environment"
else
echo "*** Cannot find go version in GOROOT value: <$GOROOT>"
false
fi
- name: Test old version
run: |
mkdir xxx
./install-go.pl 1.15.1 xxx
if [ ! -s "$GITHUB_PATH" ]; then
echo "*** GITHUB_PATH file is empty"
false
fi
if [ ! -s "$GITHUB_ENV" ]; then
echo "*** GITHUB_ENV file is empty"
false
fi
- name: Test just set PATH, GOROOT and GOPATH
run: |
env | sort
go version
go version | fgrep -q go1.15.1
if [ -z "$GOROOT" ]; then
echo "*** GOROOT is empty"
false
fi
if ! echo "$GOPATH" | egrep -q 'xxx/go/gopath$'; then
echo "*** GOPATH incorrectly set: '$GOPATH'"
false
fi
chmod -R u+w xxx
rm -rf xxx
- name: Test GOROOT_X_Y_X64 version with -p
run: |
version=$(env | perl -nE '/^GOROOT_\d+_\d+_X64=.*(\d+.\d+.\d+)/ and say $1 and exit 0')
if [ -z "$version" ]; then
echo "No GOROOT_X_Y_X64 found"
exit 0
fi
mkdir xxx
./install-go.pl -p $version xxx
./xxx/go/bin/go version | tee xxx/go-version
fgrep -q go$version xxx/go-version
if [ -s "$GITHUB_PATH" ]; then
echo "*** GITHUB_PATH file altered:"
cat $GITHUB_PATH
echo "--------------------"
false
fi
if [ ! -s "$GITHUB_ENV" ]; then
echo "*** GITHUB_ENV file is empty"
false
fi
chmod -R u+w xxx
rm -rf xxx
- name: Test old version with --dont-alter-github-path --dont-alter-github-env
run: |
mkdir xxx
./install-go.pl --dont-alter-github-path --dont-alter-github-env 1.15.x xxx
./xxx/go/bin/go version | tee xxx/go-version
fgrep -q go1.15. xxx/go-version
if [ -s "$GITHUB_PATH" ]; then
echo "*** GITHUB_PATH file altered:"
cat $GITHUB_PATH
echo "--------------------"
false
fi
if [ -s "$GITHUB_ENV" ]; then
echo "*** GITHUB_ENV file altered:"
cat $GITHUB_ENV
echo "--------------------"
false
fi
true
- name: Test already built tip
run: |
echo "GOROOT=$GOROOT" > GITHUB_PATH.prev
echo "GOPATH=$GOPATH" >> GITHUB_PATH.prev
mkdir zzz
./install-go.pl tip zzz
./zzz/go/bin/go version | tee zzz/go-version
fgrep -q 'go version devel' zzz/go-version
if [ ! -s "$GITHUB_PATH" ]; then
echo "*** GITHUB_PATH file is empty"
false
fi
if [ ! -s "$GITHUB_ENV" ]; then
echo "*** GITHUB_ENV file is empty"
false
fi
chmod -R u+w zzz
rm -rf zzz
mv GITHUB_PATH.prev "$GITHUB_ENV"
- name: Test building tip
run: |
mkdir zzz
ALWAYS_BUILD_TIP=1 ./install-go.pl tip zzz
./zzz/go/bin/go version | tee zzz/go-version
fgrep -q 'go version devel' zzz/go-version
if [ ! -s "$GITHUB_PATH" ]; then
echo "*** GITHUB_PATH file is empty"
false
fi
if [ ! -s "$GITHUB_ENV" ]; then
echo "*** GITHUB_ENV file is empty"
false
fi
chmod -R u+w zzz xxx
rm -rf zzz xxx