Skip to content

Commit

Permalink
dist: support building packages in Github Actions
Browse files Browse the repository at this point in the history
Support building packages in Github Actions.
This includes to add support building in Ubuntu, since Github Actions only
provides Ubuntu based image for Linux build.

Note that we don't use install-dependencies.sh on Github Actions, since we will
use preinstalled Java to speed up installing dependencies.

Closes: #238
  • Loading branch information
syuu1228 authored and denesb committed Sep 3, 2024
1 parent 89308b7 commit 793452a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
push:
branches:
- master
- branch-*

jobs:
build:
runs-on: ubuntu-latest
name: Build packages
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11'
cache: 'maven'
cache-dependency-path: 'scylla-jmx-parent/pom.xml'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y devscripts debhelper
- name: Build relocatable package
run: |
./reloc/build_reloc.sh --nodeps
echo "VERSION=$(./SCYLLA-VERSION-GEN)" >> "$GITHUB_ENV"
- name: Build RPM
run: |
./reloc/build_rpm.sh --reloc-pkg build/scylla-jmx-${VERSION}.noarch.tar.gz
- name: Build DEB
run: |
./reloc/build_deb.sh --reloc-pkg build/scylla-jmx-${VERSION}.noarch.tar.gz
- name: Upload relocatable package
uses: actions/upload-artifact@v4
with:
name: scylla-jmx-relocatable-${{env.VERSION}}
path: build/scylla-jmx-*.noarch.tar.gz
if-no-files-found: error
- name: Upload RPM
uses: actions/upload-artifact@v4
with:
name: scylla-jmx-rpm-${{env.VERSION}}
path: build/redhat/RPMS/noarch/scylla-jmx-*.noarch.rpm
if-no-files-found: error
- name: Upload DEB
uses: actions/upload-artifact@v4
with:
name: scylla-jmx-deb-${{env.VERSION}}
path: build/debian/scylla-jmx_*_all.deb
if-no-files-found: error
- name: Publish packages to release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
files: |
build/scylla-jmx-*.noarch.tar.gz
build/redhat/RPMS/noarch/scylla-jmx-*.noarch.rpm
build/debian/scylla-jmx_*_all.deb
2 changes: 1 addition & 1 deletion SCYLLA-VERSION-GEN
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

PRODUCT=scylla
VERSION=666.development
Expand Down
1 change: 0 additions & 1 deletion dist/redhat/scylla-jmx.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ URL: http://www.scylladb.com/
Source0: %{reloc_pkg}

BuildArch: noarch
BuildRequires: systemd-units
Requires: %{product}-server
Requires: jre-11-headless
AutoReqProv: no
Expand Down
5 changes: 3 additions & 2 deletions install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
. /etc/os-release

if [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ]; then
apt -y install maven openjdk-11-jdk-headless
apt-get update
apt-get install -y maven openjdk-11-jdk-headless git rpm devscripts debhelper fakeroot dpkg-dev
elif [ "$ID" = "fedora" ] || [ "$ID" = "centos" ]; then
dnf install -y maven java-11-openjdk-headless
dnf install -y maven java-11-openjdk-headless git rpm-build devscripts debhelper fakeroot dpkg-dev
fi
1 change: 1 addition & 0 deletions reloc/build_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ parameters=(
-D"release $SCYLLA_RELEASE"
-D"product $PRODUCT"
-D"reloc_pkg $RELOC_PKG_BASENAME"
-D"_unitdir /usr/lib/systemd/system"
)

cp dist/redhat/scylla-jmx.spec $RPMBUILD/SPECS
Expand Down

0 comments on commit 793452a

Please sign in to comment.