1- name : test
1+ name : Tests
22on :
33 push :
44 tags :
88 - main
99 pull_request :
1010jobs :
11- test :
11+ unit :
1212 strategy :
1313 matrix :
1414 go-version : [1.16.x]
@@ -24,26 +24,175 @@ jobs:
2424 --health-timeout 5s
2525 --health-retries 5
2626 steps :
27- - name : Install Go
27+ - name : Checkout the Repo
28+ uses : actions/checkout@v2
29+ - name : Setup Go
2830 uses : actions/setup-go@v2
2931 with :
3032 go-version : ${{ matrix.go-version }}
31- - name : Checkout code
32- uses : actions/checkout@v2
33- - name : Test
34- run : go test ./client ./config ./environment -v -covermode=count -coverprofile=coverage.out
35- - name : Convert coverage to lcov
36- uses :
jandelgado/[email protected] 33+ - name : Configure AWS Credentials
34+ uses : aws-actions/configure-aws-credentials@v1
35+ with :
36+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
37+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
38+ aws-region : ${{ secrets.AWS_REGION }}
39+ role-to-assume : ${{ secrets.AWS_ROLE_TO_ASSUME }}
40+ role-duration-seconds : 3600
41+ - name : Set Kubernetes Context
42+ uses : azure/k8s-set-context@v1
43+ with :
44+ method : kubeconfig
45+ kubeconfig : ${{ secrets.KUBECONFIG }}
46+ - name : Cache Vendor Packages
47+ uses : actions/cache@v2
48+ id : cache-packages
49+ with :
50+ path : |
51+ ~/.cache/go-build
52+ ~/go/pkg/mod
53+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
54+ restore-keys : |
55+ ${{ runner.os }}-go-
56+ - name : Download Go Vendor Packages
57+ if : steps.cache-packages.outputs.cache-hit != 'true'
58+ run : go mod download
59+ - name : Install Ginkgo CLI
60+ run : go install github.com/onsi/ginkgo/ginkgo
61+ - name : Run Tests
62+ run : |
63+ export PATH=$PATH:$(go env GOPATH)/bin
64+ ginkgo -r --randomizeAllSpecs --randomizeSuites -keepGoing -covermode=count -coverprofile=unit-test-coverage.out -nodes=10 ./client ./config ./environment
65+ - name : Code Coverage
66+ uses : codecov/codecov-action@v2
67+ with :
68+ files : ./unit-test-coverage.out
69+ name : codecov-umbrella
70+ - name : Publish Unit Test Results
71+ uses : mikepenz/action-junit-report@v2
3772 if : always()
38- - name : Report code coverage
39- 73+ with :
74+ report_paths : ' **/logs/tests-*.xml'
75+ github_token : ${{ secrets.GITHUB_TOKEN }}
76+ - name : Publish Artifacts
77+ if : failure()
78+ uses : actions/upload-artifact@v1
79+ with :
80+ name : test-logs
81+ path : ./logs
82+
83+ smoke :
84+ runs-on : ubuntu-latest
85+ needs : unit
86+ env :
87+ CGO_ENABLED : 0
88+ steps :
89+ - name : Checkout the repo
90+ uses : actions/checkout@v2
91+ - name : Setup go
92+ uses : actions/setup-go@v1
93+ with :
94+ go-version : 1.16
95+ - name : Configure AWS Credentials
96+ uses : aws-actions/configure-aws-credentials@v1
97+ with :
98+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
99+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
100+ aws-region : ${{ secrets.AWS_REGION }}
101+ role-to-assume : ${{ secrets.AWS_ROLE_TO_ASSUME }}
102+ role-duration-seconds : 3600
103+ - name : Set Kubernetes Context
104+ uses : azure/k8s-set-context@v1
105+ with :
106+ method : kubeconfig
107+ kubeconfig : ${{ secrets.KUBECONFIG }}
108+ - name : Cache Vendor Packages
109+ uses : actions/cache@v2
110+ id : cache-packages
111+ with :
112+ path : |
113+ ~/.cache/go-build
114+ ~/go/pkg/mod
115+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
116+ restore-keys : |
117+ ${{ runner.os }}-go-
118+ - name : Download Go Vendor Packages
119+ if : steps.cache-packages.outputs.cache-hit != 'true'
120+ run : go mod download
121+ - name : Install Ginkgo CLI
122+ run : go install github.com/onsi/ginkgo/ginkgo
123+ - name : Run Tests
124+ run : |
125+ export PATH=$PATH:$(go env GOPATH)/bin
126+ ./tools/integration_test.sh 0
127+ - name : Publish Test Results
128+ uses : mikepenz/action-junit-report@v2
40129 if : always()
41130 with :
42- github-token : ${{ secrets.GITHUB_TOKEN }}
43- lcov-file : ./coverage.lcov
44- - name : Publish Unit Test Results
131+ report_paths : ' **/logs/tests-*.xml'
132+ github_token : ${{ secrets.GITHUB_TOKEN }}
133+ - name : Publish Artifacts
134+ if : failure()
135+ uses : actions/upload-artifact@v1
136+ with :
137+ name : test-logs
138+ path : ./logs
139+
140+ performance :
141+ # Only run performance tests on significant PRs / merges to main
142+ if : startsWith(github.ref, 'v') || contains(github.ref, 'main') || contains(github.ref, 'develop')
143+ needs : unit
144+ runs-on : ubuntu-latest
145+ env :
146+ CGO_ENABLED : 0
147+ NETWORK : ethereum_geth_performance
148+ steps :
149+ - name : Checkout the repo
150+ uses : actions/checkout@v2
151+ - name : Setup Go
152+ uses : actions/setup-go@v1
153+ with :
154+ go-version : 1.16
155+ - name : Configure AWS Credentials
156+ uses : aws-actions/configure-aws-credentials@v1
157+ with :
158+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
159+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
160+ aws-region : ${{ secrets.AWS_REGION }}
161+ role-to-assume : ${{ secrets.AWS_ROLE_TO_ASSUME }}
162+ role-duration-seconds : 3600
163+ - name : Set Kubernetes Context
164+ uses : azure/k8s-set-context@v1
165+ with :
166+ method : kubeconfig
167+ kubeconfig : ${{ secrets.KUBECONFIG }}
168+ - name : Cache Vendor Packages
169+ uses : actions/cache@v2
170+ id : cache-packages
171+ with :
172+ path : |
173+ ~/.cache/go-build
174+ ~/go/pkg/mod
175+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
176+ restore-keys : |
177+ ${{ runner.os }}-go-
178+ - name : Download Go Vendor Packages
179+ if : steps.cache-packages.outputs.cache-hit != 'true'
180+ run : go mod download
181+ - name : Install Ginkgo CLI
182+ run : go install github.com/onsi/ginkgo/ginkgo
183+ - name : Run Tests
184+ run : |
185+ export PATH=$PATH:$(go env GOPATH)/bin
186+ ./tools/integration_test.sh 1
187+ - name : Publish Test Results
45188 uses : mikepenz/action-junit-report@v2
46189 if : always()
47190 with :
48- report_paths : ' **/junit .xml'
191+ report_paths : ' **/logs/tests-* .xml'
49192 github_token : ${{ secrets.GITHUB_TOKEN }}
193+ - name : Publish Artifacts
194+ if : failure()
195+ uses : actions/upload-artifact@v1
196+ with :
197+ name : test-logs
198+ path : ./logs
0 commit comments