Skip to content

Commit

Permalink
Rework CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
dfdx committed Oct 9, 2024
1 parent 240d6e0 commit 8e0db60
Show file tree
Hide file tree
Showing 12 changed files with 212 additions and 184 deletions.
10 changes: 10 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "Existing Dockerfile",
"build": {
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
}

}
40 changes: 0 additions & 40 deletions .github/workflows/CI.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

name: Test

on:
push:
branches:
- main
pull_request:
jobs:
build:
name: Test in Docker
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: docker/build-push-action@v6
with:
tags: rdkafka-jl:latest
push: false
- uses: addnab/docker-run-action@v3
with:
image: rdkafka-jl:latest
run: sh /opt/RDKafka.jl/scripts/run-tests.sh
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

133 changes: 133 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
FROM ubuntu:22.04


## Basic devcontainer setup

ENV user=devpod

ENV JAVA_VERSION=8

ENV SCALA_VERSION=2.12
ENV BINARY_SCALA_VERSION=2.12.12

ENV JULIA_VERSION=1.10.5
ENV JULIA_VERSION_SHORT=1.10

ENV KAFKA_VERSION=${SCALA_VERSION}-3.8.0
ENV KAFKA_VERSION_SHORT=3.8.0

ENV TERM=xterm-color

ENV DEBIAN_FRONTEND=noninteractive \
TERM=linux

ENV LANGUAGE=en_US.UTF-8 \
LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
LC_CTYPE=en_US.UTF-8 \
LC_MESSAGES=en_US.UTF-8

# -------------------------- SUDO LAND ------------------------------

USER root

RUN apt update && apt install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
gpg \
gpg-agent \
less \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
llvm \
locales \
tk-dev \
tzdata \
unzip \
vim \
wget \
xz-utils \
zlib1g-dev \
zstd \
&& sed -i "s/^# en_US.UTF-8 UTF-8$/en_US.UTF-8 UTF-8/g" /etc/locale.gen \
&& locale-gen \
&& update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
&& apt clean


## System packages

RUN apt-get update
RUN apt-get install -y git openssh-server


## Add user & enable sudo

# RUN id -u ${user} &>/dev/null || useradd -ms /bin/bash ${user}
RUN id -u ${user} || useradd -ms /bin/bash ${user}
RUN usermod -aG sudo ${user}

RUN apt-get install -y sudo
RUN echo "${user} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

RUN chsh -s /bin/bash ${user}

# ensure home directory exists
RUN mkdir -p /home/${user}
RUN chown -R ${user}:${user} /home/${user}

RUN touch /home/${user}/.bashrc
RUN chown ${user}:${user} /home/${user}/.bashrc


## Julia

WORKDIR /opt
RUN wget -O julia.tgz https://julialang-s3.julialang.org/bin/linux/x64/${JULIA_VERSION_SHORT}/julia-${JULIA_VERSION}-linux-x86_64.tar.gz
RUN tar -xzf julia.tgz
RUN echo "export PATH=\${PATH}:/opt/julia-${JULIA_VERSION}/bin" >> /home/${user}/.bashrc
RUN rm julia.tgz


## Java & Maven

RUN apt-get install -y openjdk-${JAVA_VERSION}-jdk
RUN update-alternatives --set java $(update-alternatives --list java | grep java-${JAVA_VERSION}) || true
RUN update-alternatives --set javac $(update-alternatives --list java | grep java-${JAVA_VERSION}) || true

RUN apt-get install -y maven


## Kafka
WORKDIR /opt
RUN wget -O kafka.tgz https://dlcdn.apache.org/kafka/${KAFKA_VERSION_SHORT}/kafka_${KAFKA_VERSION}.tgz
RUN tar -xzf kafka.tgz
RUN echo "export PATH=\${PATH}:/opt/kafka_${KAFKA_VERSION}/bin" >> /home/${user}/.bashrc
RUN rm kafka.tgz

RUN mkdir -p /opt/kafka_${KAFKA_VERSION}/logs
RUN chmod -R a+rwx /opt/kafka_${KAFKA_VERSION}/logs


## Scripts

ENV RDKAFKA_TEST_DIR=/opt/RDKafka.jl
COPY . ${RDKAFKA_TEST_DIR}
RUN chown -R ${user}:${user} ${RDKAFKA_TEST_DIR}

# -------------------------- USER LAND ------------------------------

USER ${user}


## Launch

ENTRYPOINT ["${RDKAFKA_TEST_DIR}/scripts/run-tests.sh"]
1 change: 0 additions & 1 deletion REQUIRE

This file was deleted.

45 changes: 0 additions & 45 deletions appveyor.yml

This file was deleted.

83 changes: 0 additions & 83 deletions docker-compose.yml

This file was deleted.

21 changes: 21 additions & 0 deletions scripts/run-test-kafka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

export KAFKA_HOME=/opt/kafka_${KAFKA_VERSION}
cd $KAFKA_HOME

nohup bin/zookeeper-server-start.sh config/zookeeper.properties &> /dev/null &
nohup bin/kafka-server-start.sh config/server.properties &> /dev/null &


bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092

bin/kafka-console-producer.sh --topic quickstart-events --bootstrap-server localhost:9092 <<EOF
Once upon a time
there was a developer
who spent his days and nights
in agony of debugging
EOF


# test with
# kafka-console-consumer.sh --topic quickstart-events --from-beginning --bootstrap-server localhost:9092
10 changes: 10 additions & 0 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

echo ">>>>>>> USER = $(whoami)"


cd $RDKAFKA_TEST_DIR

sh scripts/run-test-kafka.sh
/opt/julia-${JULIA_VERSION}/bin/julia -e 'import Pkg; Pkg.activate("."); Pkg.test()'
Loading

0 comments on commit 8e0db60

Please sign in to comment.