forked from apache/cassandra-gocql-driver
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
travis-ci.org switched to travis-ci.com and we wanted to switch to Github Actions anyway.
- Loading branch information
Ondrej Polakovic
committed
Feb 23, 2022
1 parent
360b71e
commit f233d92
Showing
2 changed files
with
177 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [ opened, synchronize, reopened ] | ||
|
||
jobs: | ||
build: | ||
name: Unit tests | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
go: [ '1.16', '1.17' ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-VERSION: ${{ matrix.go }} | ||
- uses: actions/cache@v2 | ||
id: gomod-cache | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- run: go vet | ||
- name: Run unit tests | ||
run: go test -tags unit -race | ||
integration-cassandra: | ||
timeout-minutes: 10 | ||
needs: | ||
- build | ||
name: Integration Tests | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go: [ '1.16', '1.17' ] | ||
cassandra_version: [ '3.0.24', '3.11.10' ] | ||
auth: [ "false" ] | ||
compressor: [ "snappy" ] | ||
tags: [ "cassandra", "integration", "ccm" ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- uses: actions/cache@v2 | ||
id: gomod-cache | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Install CCM | ||
run: pip install git+https://github.com/riptano/ccm.git@2.8.2 | ||
- name: Start cassandra nodes | ||
run: | | ||
VERSION=${{ matrix.cassandra_version }} | ||
keypath="$(pwd)/testdata/pki" | ||
conf=( | ||
"client_encryption_options.enabled: true" | ||
"client_encryption_options.keystore: $keypath/.keystore" | ||
"client_encryption_options.keystore_password: cassandra" | ||
"client_encryption_options.require_client_auth: true" | ||
"client_encryption_options.truststore: $keypath/.truststore" | ||
"client_encryption_options.truststore_password: cassandra" | ||
"concurrent_reads: 2" | ||
"concurrent_writes: 2" | ||
"rpc_server_type: sync" | ||
"rpc_min_threads: 2" | ||
"rpc_max_threads: 2" | ||
"write_request_timeout_in_ms: 5000" | ||
"read_request_timeout_in_ms: 5000" | ||
"enable_user_defined_functions: true" | ||
) | ||
ccm remove test || true | ||
ccm create test -v $VERSION -n 3 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m" | ||
ccm updateconf "${conf[@]}" | ||
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler" | ||
ccm start --wait-for-binary-proto | ||
ccm status | ||
ccm node1 nodetool status | ||
proto=4 | ||
if [[ $version == 3.*.* ]]; then | ||
proto=5 | ||
fi | ||
args="-gocql.timeout=60s -runssl -proto=$proto -rf=3 -clusterSize=3 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..." | ||
echo "args=$args" >> $GITHUB_ENV | ||
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV | ||
- name: Integration tests | ||
run: | | ||
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}" | ||
go test -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }} | ||
integration-auth-cassandra: | ||
timeout-minutes: 10 | ||
needs: | ||
- build | ||
name: Integration Tests with auth | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go: [ 1.16, 1.17 ] | ||
cassandra_version: [ 3.11.10 ] | ||
compressor: [ "snappy" ] | ||
tags: [ "integration" ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- uses: actions/cache@v2 | ||
id: gomod-cache | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Install CCM | ||
run: pip install git+https://github.com/riptano/ccm.git@2.8.2 | ||
- name: Start cassandra nodes | ||
run: | | ||
VERSION=${{ matrix.cassandra_version }} | ||
keypath="$(pwd)/testdata/pki" | ||
conf=( | ||
"client_encryption_options.enabled: true" | ||
"client_encryption_options.keystore: $keypath/.keystore" | ||
"client_encryption_options.keystore_password: cassandra" | ||
"client_encryption_options.require_client_auth: true" | ||
"client_encryption_options.truststore: $keypath/.truststore" | ||
"client_encryption_options.truststore_password: cassandra" | ||
"concurrent_reads: 2" | ||
"concurrent_writes: 2" | ||
"rpc_server_type: sync" | ||
"rpc_min_threads: 2" | ||
"rpc_max_threads: 2" | ||
"write_request_timeout_in_ms: 5000" | ||
"read_request_timeout_in_ms: 5000" | ||
"authenticator: PasswordAuthenticator" | ||
"authorizer: CassandraAuthorizer" | ||
"enable_user_defined_functions: true" | ||
) | ||
ccm remove test || true | ||
ccm create test -v $VERSION -n 1 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m" | ||
ccm updateconf "${conf[@]}" | ||
rm -rf $HOME/.ccm/test/node1/data/system_auth | ||
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler" | ||
ccm start --wait-for-binary-proto | ||
ccm status | ||
ccm node1 nodetool status | ||
args="-gocql.timeout=60s -runssl -proto=4 -rf=3 -clusterSize=1 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..." | ||
echo "args=$args" >> $GITHUB_ENV | ||
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV | ||
sleep 30s | ||
- name: Integration tests | ||
run: | | ||
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}" | ||
go test -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +0,0 @@ | ||
language: go | ||
|
||
sudo: required | ||
dist: trusty | ||
|
||
cache: | ||
directories: | ||
- $HOME/.ccm/repository | ||
- $HOME/.local/lib/python2.7 | ||
|
||
matrix: | ||
fast_finish: true | ||
|
||
branches: | ||
only: | ||
- master | ||
|
||
env: | ||
global: | ||
- GOMAXPROCS=2 | ||
matrix: | ||
- CASS=2.1.21 | ||
AUTH=true | ||
COMPRESSOR=snappy | ||
- CASS=2.2.14 | ||
AUTH=true | ||
COMPRESSOR=snappy | ||
- CASS=2.2.14 | ||
AUTH=false | ||
COMPRESSOR=snappy | ||
- CASS=3.0.18 | ||
AUTH=false | ||
COMPRESSOR=snappy | ||
- CASS=3.11.4 | ||
AUTH=false | ||
COMPRESSOR=snappy | ||
|
||
go: | ||
- 1.16.x | ||
- 1.17.x | ||
|
||
go_import_path: github.com/gocql/gocql | ||
|
||
install: | ||
- ./install_test_deps.sh $TRAVIS_REPO_SLUG | ||
- cd ../.. | ||
- cd gocql/gocql | ||
- go get . | ||
|
||
script: | ||
- set -e | ||
- PATH=$PATH:$HOME/.local/bin bash integration.sh $CASS $AUTH $COMPRESSOR | ||
- go vet . | ||
|
||
notifications: | ||
- email: false | ||