RPM packages #1321
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test rpm package installation for latest version | |
name: RPM packages | |
"on": | |
schedule: | |
# run daily 0:00 on main branch | |
- cron: '0 0 * * *' | |
pull_request: | |
paths: .github/workflows/rpm-packages.yaml | |
push: | |
tags: | |
- '*' | |
branches: | |
- release_test | |
- trigger/package_test | |
jobs: | |
rpm_tests: | |
name: RPM ${{ matrix.image }} PG${{ matrix.pg }} ${{ matrix.license }} | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ matrix.image }} | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ "rockylinux:8", "rockylinux:9" ] | |
pg: [ 14, 15, 16, 17 ] | |
license: [ "TSL", "Apache"] | |
include: | |
- license: Apache | |
pkg_suffix: "-oss" | |
steps: | |
- name: Add postgres repositories | |
run: "yum install -y \"https://download.postgresql.org/pub/repos/yum/reporpms/\ | |
EL-$(rpm -E %{rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpm\"" | |
- name: Add other repositories | |
run: | | |
tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL | |
[timescale_timescaledb] | |
name=timescale_timescaledb | |
baseurl=https://packagecloud.io/timescale/timescaledb/el/$(rpm -E %{rhel})/\$basearch | |
repo_gpgcheck=1 | |
gpgcheck=0 | |
enabled=1 | |
gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey | |
sslverify=1 | |
sslcacert=/etc/pki/tls/certs/ca-bundle.crt | |
metadata_expire=300 | |
EOL | |
- name: Install timescaledb | |
run: | | |
yum update -y | |
if [[ "$(rpm -E %{rhel})" -eq "8" ]]; then dnf -qy module disable postgresql; fi | |
yum install -y timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} sudo wget | |
sudo -u postgres /usr/pgsql-${{ matrix.pg }}/bin/initdb -D /var/lib/pgsql/${{ matrix.pg }}/data | |
timescaledb-tune --quiet --yes --pg-config /usr/pgsql-${{ matrix.pg }}/bin/pg_config | |
- name: List available versions | |
run: | | |
yum --showduplicates list timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} | |
- name: Show files in package | |
run: | | |
rpm -ql timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} | |
- uses: actions/checkout@v3 | |
- name: Read versions | |
id: versions | |
run: | | |
# read expected version from version.config | |
# version will only be a proper version in a release branch so we use update_from_version | |
# as fallback for main | |
if grep '^version = [0-9.]\+$' version.config; then | |
version=$(grep '^version = ' version.config | sed -e 's!^version = !!') | |
else | |
version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!') | |
fi | |
echo "version=${version}" >>$GITHUB_OUTPUT | |
- name: Test Installation | |
run: | | |
sudo -u postgres /usr/pgsql-${{ matrix.pg }}/bin/pg_ctl -D /var/lib/pgsql/${{ matrix.pg }}/data start | |
while ! /usr/pgsql-${{ matrix.pg }}/bin/pg_isready; do sleep 1; done | |
sudo -u postgres psql -X -c "CREATE EXTENSION timescaledb" \ | |
-c "SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb';" | |
installed_version=$(sudo -u postgres psql -X -t \ | |
-c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g') | |
if [ "${{ steps.versions.outputs.version }}" != "$installed_version" ];then | |
false | |
fi | |
- name: Test Downgrade | |
if: matrix.pg != '17' | |
run: | | |
# Since this runs nightly on main we have to get the previous version | |
# from the last released version and not current branch. | |
prev_version=$(wget --quiet -O - \ | |
https://raw.githubusercontent.com/timescale/timescaledb/${{ steps.versions.outputs.version }}/version.config \ | |
| grep update_from_version | sed -e 's!update_from_version = !!') | |
yum downgrade -y timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }}-${prev_version} | |
sudo -u postgres psql -X -c "ALTER EXTENSION timescaledb UPDATE TO '${prev_version}'" \ | |
-c "SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb';" | |
installed_version=$(sudo -u postgres psql -X -t \ | |
-c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g') | |
if [ "$prev_version" != "$installed_version" ];then | |
false | |
fi | |