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

feature(packaging): debian and rpm packaging #37

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
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
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Dockerfile
.idea/
build/
dist/
ide/
lib/
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ on:
workflow_dispatch:
inputs:
version:
required: false
required: true
description: 'Version of the release'
latest:
required: false
default: false
description: 'Build latest version'
workflow_call:
inputs:
Expand All @@ -29,7 +28,7 @@ jobs:
strategy:
matrix:
java: [ '11' ]
os: [ 'ubuntu-latest' ]
os: [ 'ubuntu-24.04' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -44,6 +43,11 @@ jobs:
with:
optional-tasks: true
version: latest
- name: Install Deps
run: |
sudo apt-get update
sudo apt-get install -y rpm dpkg-dev devscripts debhelper dh-make build-essential

- name: Build with version ${{ inputs.version }}
if: ${{ inputs.version != '' }}
run: ant -Dversion=${{ inputs.version }} -Drelease=true jar
Expand All @@ -54,7 +58,10 @@ jobs:
ant jar
- name: Artifacts
if: ${{ inputs.version != '' }}
run: ant -Dversion=${{ inputs.version }} -Drelease=true artifacts
run: |
ant -Dversion=${{ inputs.version }} -Drelease=true artifacts
./scripts/build_deb.sh --version ${{ inputs.version }}
./scripts/build_rpm.sh --version ${{ inputs.version }}
- name: Release
uses: softprops/action-gh-release@v2
id: release
Expand All @@ -68,12 +75,14 @@ jobs:
prerelease: false
fail_on_unmatched_files: true
files: |
build/cassandra-stress-${{ inputs.version }}-bin.tar.gz
build/cassandra-stress-${{ inputs.version }}-bin.tar.gz.sha256
build/cassandra-stress-${{ inputs.version }}-bin.tar.gz.sha512
build/cassandra-stress-${{ inputs.version }}-src.tar.gz
build/cassandra-stress-${{ inputs.version }}-src.tar.gz.sha256
build/cassandra-stress-${{ inputs.version }}-src.tar.gz.sha512
build/cassandra-stress-bin.tar.gz
build/cassandra-stress-bin.tar.gz.sha256
build/cassandra-stress-bin.tar.gz.sha512
build/cassandra-stress-src.tar.gz
build/cassandra-stress-src.tar.gz.sha256
build/cassandra-stress-src.tar.gz.sha512
build/cassandra-stress_${{ inputs.version }}_all.deb
build/redhat/RPMS/noarch/cassandra-stress-${{ inputs.version }}-1.noarch.rpm
- name: "Generate release changelog"
if: ${{ inputs.version != '' }}
uses: heinrichreimer/[email protected]
Expand All @@ -89,4 +98,4 @@ jobs:
commit_message: "Update CHANGELOG.md"
branch: master
commit_options: '--no-verify --signoff'
file_pattern: CHANGELOG.md
file_pattern: CHANGELOG.md
9 changes: 3 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ jobs:
strategy:
matrix:
java: [ '11' ]
os: [ 'ubuntu-latest' ]
runs-on: ${{ matrix.os }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup Ant
uses: cedx/setup-ant@v2
Expand All @@ -26,7 +25,5 @@ jobs:
version: latest
- name: Setup
run: ant init
- name: Test src
- name: Test tests
run: ant build-test
- name: Test cassandra-stress
run: ant stress-test
24 changes: 10 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,35 @@ COPY . .

RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone \
&& apt update \
&& apt install -y ant \
&& apt-get update \
&& apt-get install -y ant \
&& ant realclean \
&& mkdir -p build lib \
&& ant -Drelease=true -Dversion="$CASSANDRA_STRESS_VERSION" artifacts \
&& bash ./SCYLLA-VERSION-GEN \
&& cp build/SCYLLA-* build/dist/
&& chmod +x build/dist/bin/cassandra-stress


FROM eclipse-temurin:11-jre-noble AS production

LABEL org.opencontainers.image.source="https://github.com/scylladb/cassandra-stress"
LABEL org.opencontainers.image.title="ScyllaDB Cassandra Stress"


ENV SCYLLA_HOME=/scylla-tools-java
ENV SCYLLA_CONF=/scylla-tools-java/conf
ENV PATH=$PATH:$SCYLLA_HOME/tools/bin
ENV CASSANDRA_STRESS_HOME="/usr/local/share/cassandra-stress"
ENV PATH="$PATH:$CASSANDRA_STRESS_HOME/bin"
ENV LD_LIBRARY_PATH="/lib/x86_64-linux-gnu:/usr/local/lib:/usr/lib:/lib:/lib64:/usr/local/lib/x86_64-linux-gnu"
ENV DEBIAN_FRONTEND="noninteractive"
ENV TZ="UTC"

WORKDIR $SCYLLA_HOME
WORKDIR $CASSANDRA_STRESS_HOME

COPY --from=build /app/build/dist .

RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone \
&& apt update \
&& apt upgrade -y \
&& apt install -y libsnappy-java libsnappy-jni \
&& chmod +x tools/bin/cassandra-stress \
&& chmod +x tools/bin/cassandra-stressd \
&& rm tools/bin/*.bat \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y libsnappy-java libsnappy-jni \
&& apt-get purge -y \
gcc make g++ apt-transport-https \
autoconf bzip2 cpp libasan8 m4 libtirpc3 libtsan2 libubsan1 build-essential \
Expand Down
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
all: build

.PHONY: build
build:
@echo "Building..."
@ant jar

.PHONY: release
release:
@echo "Building release..."
@ant artifacts -Drelease=true -Dversion=$(VERSION)
@./scripts/build-rpm.sh --version $(VERSION)
CodeLieutenant marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: docker-build
docker-build:
@echo "Building docker image..."
@docker build \
-t scylla/cassandra-stress:latest \
--target production \
--build-arg CASSANDRA_STRESS_VERSION=3 \
--compress .

docker-run:
@echo "Running docker image..."
@docker run \
-it \
--name c-s \
--rm scylla/cassandra-stress:latest \
cassandra-stress $(ARGS)

.PHONY: setup
setup:
@echo "Setting up environment..."
@ant generate-idea-files
@ant build

.PHONY: clean
clean:
@echo "Cleaning..."
@ant realclean
49 changes: 0 additions & 49 deletions SCYLLA-VERSION-GEN

This file was deleted.

Loading