Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
73 changes: 73 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
ARG RHEL_VERSION
FROM rockylinux:${RHEL_VERSION}

ARG RHEL_VERSION
ARG PG_VERSION
ARG PG_RMAN_VERSION

ENV PATH /usr/pgsql-${PG_VERSION}/bin:$PATH
ENV PGDATA /var/lib/pgsql/${PG_VERSION}/data


################################################################################
#
# Prerequisite
#
################################################################################

# Install packages for build
RUN dnf update -y
RUN dnf install -y \
clang gcc git krb5-devel libselinux-devel libzstd-devel lz4-devel make \
openssl-devel pam-devel readline-devel rpmdevtools which zlib-devel

# Install PostgreSQL
RUN if [ "${RHEL_VERSION}" = "8" ]; then \
dnf install -y --enablerepo=powertools perl-IPC-Run; \
else \
dnf install -y --enablerepo=crb perl-IPC-Run; \
fi
RUN dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-${RHEL_VERSION}-x86_64/pgdg-redhat-repo-latest.noarch.rpm
RUN dnf -qy module disable postgresql
RUN dnf install -y postgresql${PG_VERSION}-server postgresql${PG_VERSION}-devel


################################################################################
#
# Build RPMs
#
################################################################################

# Build by postgres user
USER postgres
WORKDIR /var/lib/pgsql/

# Deploy the files required for the build
RUN rpmdev-setuptree
RUN git clone -b REL_${PG_VERSION}_STABLE https://github.com/ossc-db/pg_rman.git
RUN cp -a pg_rman/SPECS/pg_rman${PG_VERSION}.spec rpmbuild/SPECS
RUN cd pg_rman && \
git archive HEAD \
--format=tar.gz \
--prefix=pg_rman-${PG_RMAN_VERSION}-pg${PG_VERSION}/ \
--output=../rpmbuild/SOURCES/pg_rman-${PG_RMAN_VERSION}-pg${PG_VERSION}.tar.gz

# Build RPMs
RUN rpmbuild rpmbuild/SPECS/pg_rman${PG_VERSION}.spec \
-bb --define="dist .pg${PG_VERSION}.rhel${RHEL_VERSION}"


################################################################################
#
# Run regression tests
#
################################################################################

USER root
RUN rpm -ivh /var/lib/pgsql/rpmbuild/RPMS/x86_64/*

USER postgres
RUN initdb --no-locale -E UTF8 && \
pg_ctl -w start
RUN make -C pg_rman installcheck; exit 0
RUN cat /var/lib/pgsql/pg_rman/regression.out
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build RPMs and upload its to release draft

on:
push:
tags:
- 'V*'

jobs:
build_rpms:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
RHEL_VERSION: ["8", "9"]
PG_VERSION: ["13", "14", "15", "16", "17"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: REL_${{ matrix.PG_VERSION }}_STABLE

- name: Build PostgreSQL ${{ matrix.PG_VERSION }} RPMs for RHEL ${{ matrix.RHEL_VERSION }}
run: |
export PG_RMAN_VERSION=${GITHUB_REF_NAME#V}
docker build .github/workflows/ -t pg_rman \
--build-arg RHEL_VERSION=${{ matrix.RHEL_VERSION }} \
--build-arg PG_VERSION=${{ matrix.PG_VERSION }} \
--build-arg PG_RMAN_VERSION=${PG_RMAN_VERSION}
container_id=$(docker create pg_rman)
docker cp $container_id:/var/lib/pgsql/rpmbuild/RPMS/x86_64 ./RPMS

- name: Create release draft and upload the RPMs
uses: softprops/action-gh-release@v2
with:
name: Release draft
draft: true
files: ./RPMS/*.rpm
Loading