-
Notifications
You must be signed in to change notification settings - Fork 6
200 lines (197 loc) · 5.76 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# With thanks to:
# https://github.com/rogpeppe/go-internal/blob/master/.github/workflows/test.yml
# https://github.com/mvdan/github-actions-golang
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
fail-fast: false
matrix:
go-version: [1.21.x, 1.20.x]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
# juggling $PATH is different in Windows PowerShell,
# so let's just use bash on Windows too.
shell: bash
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
stable: false
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test (standalone)
run: |
go test ./fuzzer/...
go test ./gen
go test ./...
- name: Get date
id: get-date
run: |
# could do +%Y-%U for weekly snapshots
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
- name: Cache gotip
id: cache-gotip
uses: actions/cache@v2
with:
path: |
~/go/bin/gotip
~/go/bin/gotip.exe
~/sdk/gotip
key: ${{ runner.os }}-gotip-${{ steps.get-date.outputs.date }}
- name: Install gotip
if: steps.cache-gotip.outputs.cache-hit != 'true'
run: |
echo "$PATH"
go version
go install golang.org/dl/gotip@latest
gotip download
- name: Test (-end2end, with gotip invoked as gotip)
run: |
gotip version
echo "Current date is $(date)"
echo "ls -l ~/go/bin/gotip"
ls -l ~/go/bin/gotip
go test . -end2end
test-gotip:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
# juggling $PATH is different in Windows PowerShell,
# so let's just use bash on Windows too.
shell: bash
continue-on-error: true
steps:
- name: Set PATH
run: echo "$HOME/go/bin" >>$GITHUB_PATH
- name: Get date
id: get-date
run: |
# could do +%Y-%U for weekly snapshots
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
- name: Cache gotip
id: cache-gotip
uses: actions/cache@v2
with:
path: |
~/go/bin/gotip
~/go/bin/gotip.exe
~/sdk/gotip
key: ${{ runner.os }}-gotip-${{ steps.get-date.outputs.date }}
- name: Install gotip
if: steps.cache-gotip.outputs.cache-hit != 'true'
run: |
echo "$PATH"
go version
go install golang.org/dl/gotip@latest
gotip download
- name: Setup gotip as default go
run: |
gotip version
echo "Current date is $(date)"
echo "ls -l ~/go/bin/gotip"
ls -l ~/go/bin/gotip
echo "GOROOT=$(gotip env GOROOT)" >>$GITHUB_ENV
echo "$(gotip env GOROOT)/bin" >>$GITHUB_PATH
- name: Checkout code
uses: actions/checkout@v2
- name: Build cache and module cache
uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
$LOCALAPPDATA/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test using gotip as default go
run: |
go version
go test ./fuzzer/...
go test ./gen
go test ./...
go test . -end2end
test-external-repos:
strategy:
fail-fast: false
matrix:
external-repo: [terraform_chain, terraform_nochain]
runs-on: ubuntu-latest
defaults:
run:
# juggling $PATH is different in Windows PowerShell,
# so let's just use bash on Windows too.
shell: bash
continue-on-error: true
steps:
- name: Set PATH
run: echo "$HOME/go/bin" >>$GITHUB_PATH
- name: Get date
id: get-date
run: |
# could do +%Y-%U for weekly snapshots
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
- name: Cache gotip
id: cache-gotip
uses: actions/cache@v2
with:
path: |
~/go/bin/gotip
~/sdk/gotip
key: ${{ runner.os }}-gotip-${{ steps.get-date.outputs.date }}
- name: Install gotip
if: steps.cache-gotip.outputs.cache-hit != 'true'
run: |
echo "$PATH"
go version
go install golang.org/dl/gotip@latest
gotip download
- name: Setup gotip as default go
run: |
gotip version
echo "Current date is $(date)"
echo "ls -l ~/go/bin/gotip"
ls -l ~/go/bin/gotip
echo "GOROOT=$(gotip env GOROOT)" >>$GITHUB_ENV
echo "$(gotip env GOROOT)/bin" >>$GITHUB_PATH
- name: Checkout code
uses: actions/checkout@v2
- name: Build cache and module cache
uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
$LOCALAPPDATA/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Test
run: |
go version
go install ./cmd/fzgen
go version -m ~/go/bin/fzgen
go test . -v -end2end -allexternal -run=TestScripts/external_${{ matrix.external-repo }}