Add more otp & elixir versions to matrix
Support multiple otp & elixir version for tests
Support only newst version for static check.
Handle backward compability in tests
MODIFY
.github/workflows/checks.yml
.github/workflows/checks.yml
@@ -15,8 +15,8 @@ jobs:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
strategy:
matrix:
- elixir: ['1.12.3']
- erlang: ['24.3']
+ elixir: ['1.12']
+ otp: ['24.3']
steps:
- name: Cancel previous runs
@@ -31,7 +31,7 @@ jobs:
uses: actions/setup-elixir@v1
with:
elixir-version: ${{matrix.elixir}} # Define the elixir version [required]
- otp-version: ${{matrix.erlang}} # Define the OTP version [required]
+ otp-version: ${{matrix.otp}} # Define the OTP version [required]
experimental-otp: true # More info https://github.com/actions/setup-elixir/issues/31
- name: Retrieve Cached Dependencies
@@ -64,8 +64,8 @@ jobs:
strategy:
fail-fast: false
matrix:
- elixir: ['1.12.3']
- erlang: ['24.3']
+ elixir: ['1.12']
+ otp: ['24.3']
steps:
- name: Cancel Previous Runs
@@ -82,7 +82,7 @@ jobs:
uses: actions/setup-elixir@v1
with:
elixir-version: ${{matrix.elixir}} # Define the elixir version [required]
- otp-version: ${{matrix.erlang}} # Define the OTP version [required]
+ otp-version: ${{matrix.otp}} # Define the OTP version [required]
experimental-otp: true # More info https://github.com/actions/setup-elixir/issues/31
- name: Retrieve Cached Dependencies

MODIFY
.github/workflows/test.yml
.github/workflows/test.yml
@@ -14,8 +14,13 @@ jobs:
MIX_ENV: test
strategy:
matrix:
- elixir: ['1.12.3']
- erlang: ['24.3']
+ pair:
+ - elixir: 1.13
+ otp: 24.3
+ - elixir: 1.11
+ otp: 21.3
+ - elixir: 1.6
+ otp: 20.3
steps:
- name: Cancel previous runs
@@ -27,8 +32,8 @@ jobs:
- name: Setup elixir & erlang enviroment
uses: actions/setup-elixir@v1
with:
- elixir-version: ${{matrix.elixir}} # Define the elixir version [required]
- otp-version: ${{matrix.erlang}} # Define the OTP version [required]
+ elixir-version: ${{matrix.pair.elixir}} # Define the elixir version [required]
+ otp-version: ${{matrix.pair.otp}} # Define the OTP version [required]
experimental-otp: true # More info https://github.com/actions/setup-elixir/issues/31
- name: Retrieve Mix Dependencies Cache
@@ -36,14 +41,14 @@ jobs:
id: mix-cache # id to use in retrieve action
with:
path: deps
- key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
+ key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Retrieve Mix Dependencies Compilation Cache
uses: actions/cache@v2
id: mix-deps-compile-cache # id to use in retrieve action
with:
path: _build
- key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
+ key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Mix Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
@@ -66,17 +71,21 @@ jobs:
strategy:
fail-fast: false
matrix:
- include:
- - elixir: 1.12.3
- erlang: 24.3
+ pair:
+ - elixir: 1.13
+ otp: 24.3
+ - elixir: 1.11
+ otp: 21.3
+ - elixir: 1.6
+ otp: 20.3
steps:
- uses: actions/checkout@v2
- name: Setup elixir & erlang enviroment
uses: actions/setup-elixir@v1
with:
- elixir-version: ${{matrix.elixir}} # Define the elixir version [required]
- otp-version: ${{matrix.erlang}} # Define the OTP version [required]
+ elixir-version: ${{matrix.pair.elixir}} # Define the elixir version [required]
+ otp-version: ${{matrix.pair.otp}} # Define the OTP version [required]
experimental-otp: true # More info https://github.com/actions/setup-elixir/issues/31
- name: Retrieve Mix Dependencies Cache
@@ -84,14 +93,14 @@ jobs:
id: mix-cache # id to use in retrieve action
with:
path: deps
- key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
+ key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Retrieve Mix Dependencies Compilation Cache
uses: actions/cache@v2
id: mix-deps-compile-cache # id to use in retrieve action
with:
path: _build
- key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
+ key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-deps-compile-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Docker-compose up
run: ./scripts/docker_up.sh

MODIFY
test/socket_test.exs
test/socket_test.exs
@@ -50,7 +50,12 @@ defmodule KafkaEx.Socket.Test do
defp listen(socket) do
case :ssl.transport_accept(socket) do
{:ok, conn} ->
+ if opt_version_21_plus? do
{:ok, _socket} = :ssl.handshake(conn)
+ else
+ :ok = :ssl.ssl_accept(conn)
+ end
+
pid = spawn_link(fn -> recv(conn) end)
:ssl.controlling_process(socket, pid)
@@ -70,6 +75,11 @@ defmodule KafkaEx.Socket.Test do
:ok
end
end
+
+ defp opt_version_21_plus? do
+ {version, _} = System.otp_release() |> Float.parse()
+ version >= 21
+ end
end
setup_all do

Add more otp & elixir versions to matrix

Support multiple otp & elixir version for tests
Support only newst version for static check.
Handle backward compability in tests