Skip to content

Commit e17beb1

Browse files
committed
cache go and simulacron
1 parent 96ac672 commit e17beb1

File tree

1 file changed

+90
-18
lines changed

1 file changed

+90
-18
lines changed

.github/workflows/tests.yml

Lines changed: 90 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,43 @@ on:
99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1111
cancel-in-progress: true
12+
env:
13+
SIMULACRON_VERSION: 0.10.0
14+
GO_VERSION: 1.24.2
1215
jobs:
16+
dependencies:
17+
name: Fetch dependencies
18+
runs-on: ubuntu-latest
19+
needs: dependencies
20+
steps:
21+
- uses: actions/cache@v4
22+
id: restore-go
23+
with:
24+
path: ~/deps/godl
25+
key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }}
26+
27+
- uses: actions/cache@v4
28+
id: restore-simulacron
29+
with:
30+
path: ~/deps/simulacron
31+
key: ${{ runner.os }}-deps-simulacron-${{ env.SIMULACRON_VERSION }}
32+
33+
- if: ${{ steps.restore-go.outputs.cache-hit != 'true' }}
34+
name: Download Go
35+
continue-on-error: true
36+
run: |
37+
mkdir -p deps/godl
38+
cd deps/godl
39+
wget -O go.tar.gz https://go.dev/dl/go${{ env.GO_VERSION }}.linux-amd64.tar.gz
40+
41+
- if: ${{ steps.restore-simulacron.outputs.cache-hit != 'true' }}
42+
name: Download simulacron
43+
continue-on-error: true
44+
run: |
45+
mkdir -p deps/simulacron
46+
cd deps/simulacron
47+
wget -O simulacron.jar https://github.com/datastax/simulacron/releases/download/${{ env.SIMULACRON_VERSION }}/simulacron-standalone-${{ env.SIMULACRON_VERSION }}.jar
48+
1349
# Runs a NoSQLBench job in docker-compose with 3 proxy nodes
1450
# Verifies the written data matches in both ORIGIN and TARGET clusters
1551
nosqlbench-tests:
@@ -29,15 +65,20 @@ jobs:
2965
# Runs all the unit tests under the proxy module (all the *_test.go files)
3066
unit-tests:
3167
name: Unit Tests
68+
needs: dependencies
3269
runs-on: ubuntu-latest
3370
steps:
3471
- uses: actions/checkout@v2
72+
- uses: actions/cache@v4
73+
id: restore-go
74+
with:
75+
path: ~/deps/godl
76+
key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }}
3577
- name: Run
3678
run: |
3779
sudo apt update
3880
sudo apt -y install default-jre gcc git wget
39-
wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
40-
sudo tar -xzf go*.tar.gz -C /usr/local/
81+
sudo tar -xzf /deps/godl/go.tar.gz -C /usr/local/
4182
export PATH=$PATH:/usr/local/go/bin
4283
export PATH=$PATH:`go env GOPATH`/bin
4384
go install github.com/jstemmer/go-junit-report/v2@latest
@@ -52,21 +93,33 @@ jobs:
5293
# These tests use Simulacron and in-memory CQLServer
5394
integration-tests-mock:
5495
name: Mock Tests
96+
needs: dependencies
5597
runs-on: ubuntu-latest
5698
steps:
5799
- uses: actions/checkout@v2
58100

101+
- uses: actions/cache@v4
102+
id: restore-go
103+
with:
104+
path: ~/deps/godl
105+
key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }}
106+
107+
- uses: actions/cache@v4
108+
id: restore-simulacron
109+
with:
110+
path: ~/deps/simulacron
111+
key: ${{ runner.os }}-deps-simulacron-${{ env.SIMULACRON_VERSION }}
112+
59113
- name: Run
60114
run: |
61115
sudo apt update
62116
sudo apt -y install openjdk-8-jdk gcc git wget
63-
wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
64-
sudo tar -xzf go*.tar.gz -C /usr/local/
117+
sudo tar -xzf /deps/godl/go.tar.gz -C /usr/local/
65118
export PATH=$PATH:/usr/local/go/bin
66119
export PATH=$PATH:`go env GOPATH`/bin
67120
go install github.com/jstemmer/go-junit-report/v2@latest
68-
wget https://github.com/datastax/simulacron/releases/download/0.10.0/simulacron-standalone-0.10.0.jar
69-
export SIMULACRON_PATH=`pwd`/simulacron-standalone-0.10.0.jar
121+
cp deps/simulacron/simulacron.jar .
122+
export SIMULACRON_PATH=`pwd`/simulacron.jar
70123
go test -timeout 180m -v 2>&1 ./integration-tests | go-junit-report -set-exit-code -iocopy -out report-integration-mock.xml
71124
72125
- name: Test Summary
@@ -78,6 +131,7 @@ jobs:
78131
# Runs integration tests using CCM
79132
integration-tests-ccm:
80133
name: CCM Tests
134+
needs: dependencies
81135
runs-on: ubuntu-latest
82136
strategy:
83137
fail-fast: false
@@ -86,13 +140,17 @@ jobs:
86140
steps:
87141
- uses: actions/checkout@v2
88142

143+
- uses: actions/cache@v4
144+
id: restore-go
145+
with:
146+
path: ~/deps/godl
147+
key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }}
148+
89149
- uses: actions/cache@v4
90150
id: restore-cache-ccm
91151
with:
92152
path: ~/.ccm/repository
93-
key: ${{ runner.os }}-ccm-${{ hashFiles('**/CHANGES.txt') }}
94-
restore-keys: |
95-
${{ runner.os }}-ccm-
153+
key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }}
96154

97155
- name: Run
98156
run: |
@@ -107,8 +165,7 @@ jobs:
107165
export PATH=$JAVA_HOME/bin:$PATH
108166
java -version
109167
110-
wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
111-
sudo tar -xzf go*.tar.gz -C /usr/local/
168+
sudo tar -xzf /deps/godl/go.tar.gz -C /usr/local/
112169
export PATH=$PATH:/usr/local/go/bin
113170
export PATH=$PATH:`go env GOPATH`/bin
114171
@@ -129,7 +186,7 @@ jobs:
129186
if: always()
130187
with:
131188
path: ~/.ccm/repository
132-
key: ${{ runner.os }}-ccm-${{ hashFiles('**/CHANGES.txt') }}
189+
key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }}
133190

134191
- name: Test Summary
135192
uses: test-summary/action@v1
@@ -140,21 +197,31 @@ jobs:
140197
# Runs the mock tests with go's race checker to spot potential data races
141198
race-checker:
142199
name: Race Checker
200+
needs: dependencies
143201
runs-on: ubuntu-latest
144202
if: ${{ false }} # temporarily disabled
145203
steps:
146204
- uses: actions/checkout@v2
205+
- uses: actions/cache@v4
206+
id: restore-simulacron
207+
with:
208+
path: ~/deps/simulacron
209+
key: ${{ runner.os }}-deps-simulacron-${{ env.SIMULACRON_VERSION }}
210+
- uses: actions/cache@v4
211+
id: restore-go
212+
with:
213+
path: ~/deps/godl
214+
key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }}
147215
- name: Run
148216
run: |
149217
sudo apt update
150218
sudo apt -y install openjdk-8-jdk gcc git pip wget
151-
wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
152-
sudo tar -xzf go*.tar.gz -C /usr/local/
219+
sudo tar -xzf /deps/godl/go.tar.gz -C /usr/local/
153220
export PATH=$PATH:/usr/local/go/bin
154221
export PATH=$PATH:`go env GOPATH`/bin
155222
go install github.com/jstemmer/go-junit-report/v2@latest
156-
wget https://github.com/datastax/simulacron/releases/download/0.10.0/simulacron-standalone-0.10.0.jar
157-
export SIMULACRON_PATH=`pwd`/simulacron-standalone-0.10.0.jar
223+
cp /deps/simulacron/simulacron.jar .
224+
export SIMULACRON_PATH=`pwd`/simulacron.jar
158225
go test -race -timeout 180m -v 2>&1 ./integration-tests | go-junit-report -set-exit-code -iocopy -out report-integration-race.xml
159226
- name: Test Summary
160227
uses: test-summary/action@v1
@@ -165,16 +232,21 @@ jobs:
165232
# Performs static analysis to check for things like context leaks
166233
go-vet:
167234
name: Go Vet
235+
needs: dependencies
168236
runs-on: ubuntu-latest
169237
if: ${{ false }} # temporarily disabled
170238
steps:
171239
- uses: actions/checkout@v2
240+
- uses: actions/cache@v4
241+
id: restore-go
242+
with:
243+
path: ~/deps/godl
244+
key: ${{ runner.os }}-deps-godl-${{ env.GO_VERSION }}
172245
- name: Run
173246
run: |
174247
sudo apt update
175248
sudo apt -y install openjdk-8-jdk gcc git pip wget
176-
wget https://go.dev/dl/go1.24.2.linux-amd64.tar.gz
177-
sudo tar -xzf go*.tar.gz -C /usr/local/
249+
sudo tar -xzf /deps/godl/go.tar.gz -C /usr/local/
178250
export PATH=$PATH:/usr/local/go/bin
179251
export PATH=$PATH:`go env GOPATH`/bin
180252
go vet ./...

0 commit comments

Comments
 (0)