Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions checks cdn #460

Merged
merged 33 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f1ff283
Add github actions file (no kafka yet)
dantswain Nov 7, 2020
a8cb67c
Remove .travis.yml
dantswain Nov 7, 2020
0e118b2
Add docker-compose up
dantswain Nov 7, 2020
e539d4d
Run integration tests
dantswain Nov 7, 2020
13fba98
Docker ps
dantswain Nov 7, 2020
c5e78b0
Try services
dantswain Nov 7, 2020
e13cc37
Fix indentation in Services; remove docker-compose up
gerbal Jan 7, 2021
6cbb6cf
Run CI on all branches
gerbal Jan 7, 2021
f2af33c
Remove duplicate depends_on in docker-compose.yml
gerbal Jan 7, 2021
daaa7f7
Try a straight dockerized CI mimicking Travis
gerbal Jan 7, 2021
784f52a
create test.yml to run CI Test Suite
gerbal Jan 7, 2021
039c151
Add common Checks to Github actions CI
gerbal Jan 7, 2021
070aee7
Merge remote-tracking branch 'origin/master' into github-actions-checks
gerbal Jan 7, 2021
51a1574
Split integration test stages up
gerbal Jan 7, 2021
8281368
run test suite on push for testing
gerbal Jan 7, 2021
94dd522
test - wait for setup stage to cache deps
gerbal Jan 7, 2021
888feef
Try running test suite args with matrix
gerbal Jan 7, 2021
729df7c
run Suit checks via matrix too
gerbal Jan 7, 2021
0526100
Disable fast failures on test matrix
gerbal Jan 7, 2021
01e9ee9
Correct credo runner command
gerbal Jan 7, 2021
51cb92d
improve naming and specify complete command in matrix
gerbal Jan 7, 2021
4ee2cfc
try tweaking kafka config to use fewer threads
gerbal Jan 7, 2021
e2822db
Update workflows to work with OTP
Argonus Apr 14, 2022
9ad7bd4
Update to confluent kafka
Argonus Apr 21, 2022
52568e7
MInor fixes
Argonus Apr 21, 2022
17939d1
Merge remote-tracking branch 'origin/master' into github-actions-chec…
Argonus Apr 21, 2022
d598aac
MIx format & fix dialyxir
Argonus Apr 21, 2022
d0bd9c6
Final fixes
Argonus Apr 21, 2022
6e61a0a
Merge remote-tracking branch 'upstream/master' into github-actions-ch…
Argonus May 5, 2022
5a3b861
Add more otp & elixir versions to matrix
Argonus May 5, 2022
5e038a1
Add badges
Argonus May 5, 2022
776da20
Fix syntax in socket tests
Argonus May 5, 2022
158c037
Apply CR
Argonus Jun 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI Checks

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
dependencies:
name: check | setup dependencies
runs-on: ubuntu-20.04
env:
MIX_ENV: dev
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
strategy:
matrix:
elixir: ['1.12']
otp: ['24.3']

steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout Github repo
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.otp}} # Define the OTP version [required]
experimental-otp: true # More info https://github.com/actions/setup-elixir/issues/31

- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}

- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
mix dialyzer --plt

static_code_analysis:
name: Static Code Analysis
runs-on: ubuntu-20.04
needs: [dependencies]
env:
MIX_ENV: dev

strategy:
fail-fast: false
matrix:
elixir: ['1.12']
otp: ['24.3']

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup elixir & erlang enviroment
uses: actions/setup-elixir@v1
with:
elixir-version: ${{matrix.elixir}} # Define the elixir 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
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}

- name: Compile
run: mix compile --force

- name: Check Code Format
run: mix format --check-formatted

- name: Run Credo
run: mix credo

- name: Run Dialyzer
run: mix dialyzer --no-check
Argonus marked this conversation as resolved.
Show resolved Hide resolved
110 changes: 110 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: CI Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
setup:
name: test / setup
runs-on: ubuntu-20.04
env:
MIX_ENV: test
strategy:
matrix:
pair:
- elixir: 1.13
otp: 24.3
- elixir: 1.11
otp: 21.3
- elixir: 1.6
otp: 20.3

steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout Github repo
uses: actions/checkout@v2
- name: Setup elixir & erlang enviroment
uses: actions/setup-elixir@v1
with:
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
uses: actions/cache@v2
id: mix-cache # id to use in retrieve action
with:
path: deps
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.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: |
mix local.rebar --force
mix local.hex --force
mix deps.get

- name: Compile Mix Dependencies
if: steps.mix-deps-compile-cache.outputs.cache-hit != 'true'
run: mix deps.compile

test:
name: runner / Test
needs: [setup]

runs-on: ubuntu-20.04
env:
MIX_ENV: test

strategy:
fail-fast: false
matrix:
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.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
uses: actions/cache@v2
id: mix-cache # id to use in retrieve action
with:
path: deps
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.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
- name: Docker ps
run: docker ps -a
- name: Run Tests
run: ./scripts/ci_tests.sh
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
KafkaEx
========

[![Build Status](https://travis-ci.org/kafkaex/kafka_ex.svg?branch=master)](https://travis-ci.org/kafkaex/kafka_ex)
[![CI Tests](https://github.com/kafkaex/kafka_ex/actions/workflows/test.yml/badge.svg)](https://github.com/kafkaex/kafka_ex/actions/workflows/test.yml)
[![CI Checks](https://github.com/kafkaex/kafka_ex/actions/workflows/checks.yml/badge.svg)](https://github.com/kafkaex/kafka_ex/actions/workflows/checks.yml)
[![Coverage Status](https://coveralls.io/repos/github/kafkaex/kafka_ex/badge.svg?branch=master)](https://coveralls.io/github/kafkaex/kafka_ex?branch=master)
[![Hex.pm version](https://img.shields.io/hexpm/v/kafka_ex.svg?style=flat-square)](https://hex.pm/packages/kafka_ex)
[![Hex.pm downloads](https://img.shields.io/hexpm/dt/kafka_ex.svg?style=flat-square)](https://hex.pm/packages/kafka_ex)
Expand Down Expand Up @@ -401,7 +402,7 @@ mix test --no-start
If you are not using the Docker test cluster, you may need to modify
`config/config.exs` for your set up.

The full test suite requires Kafka 0.10.1.0+.
The full test suite requires Kafka 2.1.0+.

##### Kafka >= 0.9.0

Expand Down
6 changes: 4 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ config :kafka_ex,
# server.properties file.
# In the case below you would set "advertised.host.name=localhost"
brokers: [
{"localhost", 9092},
{"localhost", 9093},
{"localhost", 9094},
{"localhost", 9095}
{"localhost", 9094}
],
#
# OR:
Expand Down Expand Up @@ -67,6 +67,8 @@ config :kafka_ex,
# see SSL OPTION DESCRIPTIONS - CLIENT SIDE at http://erlang.org/doc/man/ssl.html
# for supported options
ssl_options: [
# Fix warnings. More at https://github.com/erlang/otp/issues/5352
verify: :verify_none,
cacertfile: File.cwd!() <> "/ssl/ca-cert",
certfile: File.cwd!() <> "/ssl/cert.pem",
keyfile: File.cwd!() <> "/ssl/key.pem"
Expand Down
24 changes: 10 additions & 14 deletions docker-compose-kafka.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

# Note: any property `something.bla` can be configure by setting `KAFKA_SOMETHING_BLA`.

######## topic creation

KAFKA_CREATE_TOPICS=consumer_group_implementation_test:4:2,test0p8p0:4:2

######## zookeeper

KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
Expand All @@ -16,31 +12,31 @@ KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS=6000
######## advertised hosts names and protocols

# alternative to KAFKA_ADVERTISED_HOST_NAME is: HOSTNAME_COMMAND: ip addr | grep -o "inet [0-9.]*" | grep -v "127\.0\.0\.1" | grep -o "[0-9.]*"
KAFKA_ADVERTISED_HOST_NAME=localhost
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INSIDE:PLAINTEXT,OUTSIDE:SSL
KAFKA_ADVERTISED_PROTOCOL_NAME=OUTSIDE
KAFKA_PROTOCOL_NAME=INSIDE
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=INTERNAL:PLAINTEXT,EXTERNAL:SSL
KAFKA_INTER_BROKER_LISTENER_NAME=INTERNAL

######## SSL

KAFKA_SSL_KEYSTORE_LOCATION=/ssl/server.keystore.jks
KAFKA_SSL_KEYSTORE_LOCATION=/etc/kafka/secrets/kafka.server.keystore.jks
KAFKA_SSL_KEYSTORE_PASSWORD=kafka_ex
KAFKA_SSL_KEY_PASSWORD=kafka_ex
KAFKA_SSL_TRUSTSTORE_LOCATION=/ssl/server.truststore.jks

KAFKA_SSL_TRUSTSTORE_LOCATION=/etc/kafka/secrets/kafka.server.truststore.jks
KAFKA_SSL_TRUSTSTORE_PASSWORD=kafka_ex
KAFKA_SSL_SECURE_RANDOM_IMPLEMENTATION=SHA1PRNG

######## Config

KAFKA_DELETE_TOPIC_ENABLE=true
# KAFKA_NUM_NETWORK_THREADS=3
# KAFKA_NUM_IO_THREADS=8
KAFKA_NUM_NETWORK_THREADS=1
KAFKA_NUM_IO_THREADS=1
KAFKA_BACKGROUND_THREADS=1
KAFKA_LOG_CLEANER_THREADS=1
# KAFKA_SOCKET_SEND_BUFFER_BYTES=102400
# KAFKA_SOCKET_RECEIVE_BUFFER_BYTES=102400
# KAFKA_SOCKET_REQUEST_MAX_BYTES=104857600
KAFKA_LOG_DIRS=/tmp/kafka_log
KAFKA_NUM_PARTITIONS=1
KAFKA_NUM_RECOVERY_THREADS_PER_DATA_DIR=1
KAFKA_LOG_RETENTION_HOURS=168
KAFKA_LOG_RETENTION_HOURS=1
# KAFKA_LOG_SEGMENT_BYTES=1073741824
# KAFKA_LOG_RETENTION_CHECK_INTERVAL_MS=300000
Loading