Skip to content

Commit

Permalink
Add github action to test RPM
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Tanwar <[email protected]>
  • Loading branch information
ritanwar committed Sep 20, 2023
1 parent cb5984f commit 613494e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/test_rpm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: BabelfishDump RPM Test
on: [push, pull_request]

jobs:
build-rpm:
name: Build BabelfishDump RPM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
id: checkout

- name: Install Dependencies
id: install-dependencies
if: always()
run: |
sudo apt clean && sudo apt-get update --fix-missing -y
sudo apt-get install alien libossp-uuid-dev uuid-dev zlib1g-dev liblz4-dev libicu-dev libxml2-dev openssl libssl-dev libpq-dev pkg-config bison flex libkrb5-dev libpam-dev libreadline-dev
- name: Run RPM command
id: run-rpm-command
if: always() && steps.install-dependencies.outcome == 'success'
run: |
make rpm
- name: Install RPM
id: install-rpm
if: always() && steps.run-rpm-command.outcome == 'success'
run: |
cd build
# Install RPM package
sudo alien -i BabelfishDump-*
# Verify that utilites installed correctly
bbf_dumpall -V
bbf_dump -V
2 changes: 2 additions & 0 deletions BabelfishDump.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This spec file and ancillary files are licensed in accordance with
# The PostgreSQL license.
# This spec file bundles the Babelfish dump utilities (bbf_dump/bbf_dumpall)
# into an RPM.

# In this file you can find the default build package list macros.
# These can be overridden by defining on the rpm command line:
Expand Down
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ all check install installdirs installcheck installcheck-parallel uninstall clean
false; \
fi

# Targets in the portion below can be used to generate source tarball
# and RPM containing Babelfish dump utilities (bbf_dump/bbf_dumpall).
PACKAGE_NAME = BabelfishDump
SOURCE_TARBALL = $(PACKAGE_NAME).tar.gz
SPECFILE = $(PACKAGE_NAME).spec
BUILD_DIR = build/rpmbuild
DIRS = 'SPECS' 'COORD_SOURCES' 'DATA_SOURCES' 'BUILD' 'RPMS' 'SOURCES' 'SRPMS'

.PHONY: rpm-clean
rpm-clean:
Expand All @@ -72,12 +75,18 @@ tarball: rpm-clean
.PHONY: sources
sources: tarball

ifdef NODEPS
RPMOPT = -ba -v --nodeps
else
RPMOPT = -ba -v
endif

.PHONY: rpm-only
rpm-only:
mkdir -p $(BUILD_DIR)/{SPECS,COORD_SOURCES,DATA_SOURCES,BUILD,RPMS,SOURCES,SRPMS}
mkdir -p $(addprefix $(BUILD_DIR)/,$(DIRS))
cp $(SPECFILE) $(BUILD_DIR)/SPECS
cp $(SOURCE_TARBALL) $(BUILD_DIR)/SOURCES
rpmbuild -ba --define "_topdir `pwd`/$(BUILD_DIR)" $(BUILD_DIR)/SPECS/$(SPECFILE)
rpmbuild $(RPMOPT) --define "_topdir `pwd`/$(BUILD_DIR)" $(BUILD_DIR)/SPECS/$(SPECFILE)
cp $(BUILD_DIR)/RPMS/*/*rpm build

.PHONY: rpm
Expand Down

0 comments on commit 613494e

Please sign in to comment.