diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbba291..9e15091 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,10 +12,11 @@ jobs: strategy: fail-fast: false matrix: + rebar3: + - '3.20.0' otp: - - '24.1' - - '23.3.4.7' - - '22.3.4.21' + - '26' + - '25' kafka: - '2.4' - '1.1' @@ -30,16 +31,16 @@ jobs: uses: actions/cache@v2 with: path: ~/.cache/rebar3/hex/hexpm/packages - key: ${{ runner.os }}-hex-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.lock')) }} + key: ${{ runner.os }}-hex2-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.lock')) }} restore-keys: | - ${{ runner.os }}-hex- + ${{ runner.os }}-hex2- - name: Cache Dialyzer PLTs uses: actions/cache@v2 with: path: ~/.cache/rebar3/rebar3_*_plt - key: ${{ runner.os }}-dialyzer-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.config')) }} + key: ${{ runner.os }}--dialyzer2-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.config')) }} restore-keys: | - ${{ runner.os }}-dialyzer- + ${{ runner.os }}-dialyzer2- # Install Erlang - name: Install Erlang/OTP @@ -47,7 +48,7 @@ jobs: with: version-type: strict otp-version: ${{matrix.otp}} - rebar3-version: '3.17.0' + rebar3-version: ${{matrix.rebar3}} # Compile - name: Compile diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9da108b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: erlang - -sudo: required - -services: - - docker - -# install latest rebar3 because the one travis provids doesn't support cover_export_name option -before_install: - - | - git clone https://github.com/erlang/rebar3.git - pushd . - cd rebar3 - ./bootstrap - sudo mv rebar3 /usr/local/bin/ - popd - - sudo docker info - -notifications: - email: false - -otp_release: - - "23.0.2" - - "22.3.4" - -script: - - make - - make xref - - make edoc - - | - OTP_VSN=`erl -noshell -eval 'io:format(erlang:system_info(otp_release)), halt(0)'` - if [ $OTP_VSN -eq 21 ]; then - make dialyze - fi - - export KAFKA_VERSION=2.4 && make test-env && make eunit - - export KAFKA_VERSION=1.1 && make test-env && make eunit - - export KAFKA_VERSION=0.11 && make test-env && make eunit - - export KAFKA_VERSION=0.10 && make test-env && make eunit - - export KAFKA_VERSION=0.9 && make test-env && export KPRO_TEST_KAFKA_09=1 && make eunit - - make cover diff --git a/Makefile b/Makefile index 1383e12..3318dc4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -KAFKA_VERSION ?= 2.4 +export KAFKA_VERSION ?= 2.4 all: compile rebar ?= $(shell which rebar3) diff --git a/scripts/docker-compose.yml b/scripts/docker-compose.yml index bcec674..257a413 100644 --- a/scripts/docker-compose.yml +++ b/scripts/docker-compose.yml @@ -1,35 +1,17 @@ version: '2' services: - pause: - image: "gcr.io/google_containers/pause-amd64:3.0" - networks: - - pausenet - ports: - - "2181:2181" - - "9092:9092" - - "9093:9093" - - "9094:9094" - - "9095:9095" - - "9192:9192" - - "9193:9193" - - "9194:9194" - - "9195:9195" - container_name: pause zookeeper: - depends_on: - - pause image: "zmstone/kafka:${KAFKA_VERSION}" container_name: zookeeper command: run zookeeper - network_mode: service:pause + network_mode: host kafka_1: depends_on: - - pause - zookeeper image: "zmstone/kafka:${KAFKA_VERSION}" container_name: 'kafka-1' - network_mode: service:pause + network_mode: host environment: BROKER_ID: 0 PLAINTEXT_PORT: 9092 @@ -40,11 +22,10 @@ services: ZOOKEEPER_CONNECT: "localhost:2181" kafka_2: depends_on: - - pause - zookeeper image: "zmstone/kafka:${KAFKA_VERSION}" container_name: 'kafka-2' - network_mode: service:pause + network_mode: host environment: BROKER_ID: 1 PLAINTEXT_PORT: 9192 @@ -53,6 +34,3 @@ services: SASL_PLAINTEXT_PORT: 9195 ADVERTISED_HOSTNAME: localhost ZOOKEEPER_CONNECT: "localhost:2181" - -networks: - pausenet: diff --git a/scripts/setup-test-env.sh b/scripts/setup-test-env.sh index edc3a7b..f05b2df 100755 --- a/scripts/setup-test-env.sh +++ b/scripts/setup-test-env.sh @@ -5,7 +5,7 @@ docker ps > /dev/null || { exit 1 } -VERSION=${KAFKA_VERSION:-1.1} +VERSION=${KAFKA_VERSION:-2.4} if [ -z $VERSION ]; then VERSION=$1; fi case $VERSION in diff --git a/src/kpro_brokers.erl b/src/kpro_brokers.erl index 7f1b97e..964a6a4 100644 --- a/src/kpro_brokers.erl +++ b/src/kpro_brokers.erl @@ -26,7 +26,9 @@ ]). -include("kpro_private.hrl"). +-ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). +-endif. -type endpoint() :: kpro:endpoint(). -type topic() :: kpro:topic(). diff --git a/src/kpro_connection.erl b/src/kpro_connection.erl index f48faf1..1df45ed 100644 --- a/src/kpro_connection.erl +++ b/src/kpro_connection.erl @@ -42,7 +42,9 @@ ]). -include("kpro_private.hrl"). +-ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). +-endif. -define(DEFAULT_CONNECT_TIMEOUT, timer:seconds(5)). -define(DEFAULT_REQUEST_TIMEOUT, timer:minutes(4)). diff --git a/test/kpro_test_lib.erl b/test/kpro_test_lib.erl index 96dfab4..b1e0e04 100644 --- a/test/kpro_test_lib.erl +++ b/test/kpro_test_lib.erl @@ -257,6 +257,7 @@ default_ssl_options() -> , {keyfile, Fname("client.key")} , {certfile, Fname("client.crt")} , {verify, verify_none} + , {versions, ['tlsv1.2']} ]. osenv(Name) ->