1name: RPM packages 2on: 3 schedule: 4 # run daily 0:00 on master branch 5 - cron: '0 0 * * *' 6 push: 7 tags: 8 - '*' 9 branches: 10 - release_test 11jobs: 12 rpm_tests: 13 name: RPM ${{ matrix.image }} PG${{ matrix.pg }} ${{ matrix.license }} 14 runs-on: ubuntu-latest 15 container: 16 image: ${{ matrix.image }} 17 strategy: 18 fail-fast: false 19 matrix: 20 image: [ "centos:centos7", "centos:centos8" ] 21 pg: [ 12, 13, 14 ] 22 license: [ "TSL", "Apache"] 23 include: 24 - license: Apache 25 pkg_suffix: "-oss" 26 27 steps: 28 - name: Add repositories 29 run: | 30 yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-$(rpm -E %{rhel})-x86_64/pgdg-redhat-repo-latest.noarch.rpm 31 tee /etc/yum.repos.d/timescale_timescaledb.repo <<EOL 32 [timescale_timescaledb] 33 name=timescale_timescaledb 34 baseurl=https://packagecloud.io/timescale/timescaledb/el/$(rpm -E %{rhel})/\$basearch 35 repo_gpgcheck=1 36 gpgcheck=0 37 enabled=1 38 gpgkey=https://packagecloud.io/timescale/timescaledb/gpgkey 39 sslverify=1 40 sslcacert=/etc/pki/tls/certs/ca-bundle.crt 41 metadata_expire=300 42 EOL 43 44 - name: Install timescaledb 45 run: | 46 yum update -y 47 if command -v dnf; then dnf -qy module disable postgresql; fi 48 yum install -y timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} sudo wget 49 sudo -u postgres /usr/pgsql-${{ matrix.pg }}/bin/initdb -D /var/lib/pgsql/${{ matrix.pg }}/data 50 timescaledb-tune --quiet --yes --pg-config /usr/pgsql-${{ matrix.pg }}/bin/pg_config 51 52 - name: List available versions 53 run: | 54 yum --showduplicates list timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} 55 56 - name: Show files in package 57 run: | 58 rpm -ql timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} 59 60 - uses: actions/checkout@v2 61 62 - name: Read versions 63 id: versions 64 run: | 65 # read expected version from version.config 66 # version will only be a proper version in a release branch so we use update_from_version 67 # as fallback for master 68 if grep '^version = [0-9.]\+$' version.config; then 69 version=$(grep '^version = ' version.config | sed -e 's!^version = !!') 70 else 71 version=$(grep '^update_from_version = ' version.config | sed -e 's!^update_from_version = !!') 72 fi 73 echo "::set-output name=version::${version}" 74 75 - name: Test Installation 76 run: | 77 sudo -u postgres /usr/pgsql-${{ matrix.pg }}/bin/pg_ctl -D /var/lib/pgsql/${{ matrix.pg }}/data start 78 while ! /usr/pgsql-${{ matrix.pg }}/bin/pg_isready; do sleep 1; done 79 sudo -u postgres psql -X -c "CREATE EXTENSION timescaledb;SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb';" 80 installed_version=$(sudo -u postgres psql -X -t -c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g') 81 if [ "${{ steps.versions.outputs.version }}" != "$installed_version" ];then 82 false 83 fi 84 85 - name: Test Downgrade 86 if: matrix.pg != 14 87 run: | 88 # since this runs nightly on master we have to get the previous version from the last released version and not current branch 89 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 = !!') 90 yum downgrade -y timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }}-${prev_version} 91 sudo -u postgres psql -X -c "ALTER EXTENSION timescaledb UPDATE TO '${prev_version}';SELECT extname,extversion,version() FROM pg_extension WHERE extname='timescaledb';" 92 installed_version=$(sudo -u postgres psql -X -t -c "SELECT extversion FROM pg_extension WHERE extname='timescaledb';" | sed -e 's! !!g') 93 if [ "$prev_version" != "$installed_version" ];then 94 false 95 fi 96 97