Skip to content

Commit f233d92

Browse files
author
Ondrej Polakovic
committed
Use Github actions for CI
travis-ci.org switched to travis-ci.com and we wanted to switch to Github Actions anyway.
1 parent 360b71e commit f233d92

File tree

2 files changed

+177
-56
lines changed

2 files changed

+177
-56
lines changed

.github/workflows/main.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [ opened, synchronize, reopened ]
9+
10+
jobs:
11+
build:
12+
name: Unit tests
13+
runs-on: ubuntu-18.04
14+
strategy:
15+
matrix:
16+
go: [ '1.16', '1.17' ]
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions/setup-go@v2
20+
with:
21+
go-VERSION: ${{ matrix.go }}
22+
- uses: actions/cache@v2
23+
id: gomod-cache
24+
with:
25+
path: ~/go/pkg/mod
26+
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
27+
restore-keys: |
28+
${{ runner.os }}-go-
29+
- run: go vet
30+
- name: Run unit tests
31+
run: go test -tags unit -race
32+
integration-cassandra:
33+
timeout-minutes: 10
34+
needs:
35+
- build
36+
name: Integration Tests
37+
runs-on: ubuntu-18.04
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
go: [ '1.16', '1.17' ]
42+
cassandra_version: [ '3.0.24', '3.11.10' ]
43+
auth: [ "false" ]
44+
compressor: [ "snappy" ]
45+
tags: [ "cassandra", "integration", "ccm" ]
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: actions/setup-go@v2
49+
with:
50+
go-version: ${{ matrix.go }}
51+
- uses: actions/cache@v2
52+
id: gomod-cache
53+
with:
54+
path: ~/go/pkg/mod
55+
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
56+
restore-keys: |
57+
${{ runner.os }}-go-
58+
- name: Install CCM
59+
run: pip install git+https://github.com/riptano/[email protected]
60+
- name: Start cassandra nodes
61+
run: |
62+
VERSION=${{ matrix.cassandra_version }}
63+
keypath="$(pwd)/testdata/pki"
64+
conf=(
65+
"client_encryption_options.enabled: true"
66+
"client_encryption_options.keystore: $keypath/.keystore"
67+
"client_encryption_options.keystore_password: cassandra"
68+
"client_encryption_options.require_client_auth: true"
69+
"client_encryption_options.truststore: $keypath/.truststore"
70+
"client_encryption_options.truststore_password: cassandra"
71+
"concurrent_reads: 2"
72+
"concurrent_writes: 2"
73+
"rpc_server_type: sync"
74+
"rpc_min_threads: 2"
75+
"rpc_max_threads: 2"
76+
"write_request_timeout_in_ms: 5000"
77+
"read_request_timeout_in_ms: 5000"
78+
"enable_user_defined_functions: true"
79+
)
80+
81+
ccm remove test || true
82+
83+
ccm create test -v $VERSION -n 3 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
84+
ccm updateconf "${conf[@]}"
85+
86+
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
87+
88+
ccm start --wait-for-binary-proto
89+
ccm status
90+
ccm node1 nodetool status
91+
92+
proto=4
93+
if [[ $version == 3.*.* ]]; then
94+
proto=5
95+
fi
96+
97+
args="-gocql.timeout=60s -runssl -proto=$proto -rf=3 -clusterSize=3 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
98+
99+
echo "args=$args" >> $GITHUB_ENV
100+
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
101+
- name: Integration tests
102+
run: |
103+
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
104+
go test -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
105+
integration-auth-cassandra:
106+
timeout-minutes: 10
107+
needs:
108+
- build
109+
name: Integration Tests with auth
110+
runs-on: ubuntu-18.04
111+
strategy:
112+
fail-fast: false
113+
matrix:
114+
go: [ 1.16, 1.17 ]
115+
cassandra_version: [ 3.11.10 ]
116+
compressor: [ "snappy" ]
117+
tags: [ "integration" ]
118+
119+
steps:
120+
- uses: actions/checkout@v2
121+
- uses: actions/setup-go@v2
122+
with:
123+
go-version: ${{ matrix.go }}
124+
- uses: actions/cache@v2
125+
id: gomod-cache
126+
with:
127+
path: ~/go/pkg/mod
128+
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
129+
restore-keys: |
130+
${{ runner.os }}-go-
131+
- name: Install CCM
132+
run: pip install git+https://github.com/riptano/[email protected]
133+
- name: Start cassandra nodes
134+
run: |
135+
VERSION=${{ matrix.cassandra_version }}
136+
keypath="$(pwd)/testdata/pki"
137+
conf=(
138+
"client_encryption_options.enabled: true"
139+
"client_encryption_options.keystore: $keypath/.keystore"
140+
"client_encryption_options.keystore_password: cassandra"
141+
"client_encryption_options.require_client_auth: true"
142+
"client_encryption_options.truststore: $keypath/.truststore"
143+
"client_encryption_options.truststore_password: cassandra"
144+
"concurrent_reads: 2"
145+
"concurrent_writes: 2"
146+
"rpc_server_type: sync"
147+
"rpc_min_threads: 2"
148+
"rpc_max_threads: 2"
149+
"write_request_timeout_in_ms: 5000"
150+
"read_request_timeout_in_ms: 5000"
151+
"authenticator: PasswordAuthenticator"
152+
"authorizer: CassandraAuthorizer"
153+
"enable_user_defined_functions: true"
154+
)
155+
156+
ccm remove test || true
157+
158+
ccm create test -v $VERSION -n 1 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
159+
ccm updateconf "${conf[@]}"
160+
161+
rm -rf $HOME/.ccm/test/node1/data/system_auth
162+
163+
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
164+
165+
ccm start --wait-for-binary-proto
166+
ccm status
167+
ccm node1 nodetool status
168+
169+
args="-gocql.timeout=60s -runssl -proto=4 -rf=3 -clusterSize=1 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
170+
171+
echo "args=$args" >> $GITHUB_ENV
172+
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
173+
sleep 30s
174+
- name: Integration tests
175+
run: |
176+
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
177+
go test -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}

.travis.yml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +0,0 @@
1-
language: go
2-
3-
sudo: required
4-
dist: trusty
5-
6-
cache:
7-
directories:
8-
- $HOME/.ccm/repository
9-
- $HOME/.local/lib/python2.7
10-
11-
matrix:
12-
fast_finish: true
13-
14-
branches:
15-
only:
16-
- master
17-
18-
env:
19-
global:
20-
- GOMAXPROCS=2
21-
matrix:
22-
- CASS=2.1.21
23-
AUTH=true
24-
COMPRESSOR=snappy
25-
- CASS=2.2.14
26-
AUTH=true
27-
COMPRESSOR=snappy
28-
- CASS=2.2.14
29-
AUTH=false
30-
COMPRESSOR=snappy
31-
- CASS=3.0.18
32-
AUTH=false
33-
COMPRESSOR=snappy
34-
- CASS=3.11.4
35-
AUTH=false
36-
COMPRESSOR=snappy
37-
38-
go:
39-
- 1.16.x
40-
- 1.17.x
41-
42-
go_import_path: github.com/gocql/gocql
43-
44-
install:
45-
- ./install_test_deps.sh $TRAVIS_REPO_SLUG
46-
- cd ../..
47-
- cd gocql/gocql
48-
- go get .
49-
50-
script:
51-
- set -e
52-
- PATH=$PATH:$HOME/.local/bin bash integration.sh $CASS $AUTH $COMPRESSOR
53-
- go vet .
54-
55-
notifications:
56-
- email: false

0 commit comments

Comments
 (0)