-
Notifications
You must be signed in to change notification settings - Fork 890
104 lines (94 loc) · 4.16 KB
/
apt-packages.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Test installing our ubuntu and debian packages for the latest version.
name: APT packages
"on":
schedule:
# run daily 0:00 on main branch
- cron: '0 0 * * *'
push:
tags:
- '*'
branches:
- release_test
jobs:
apt_tests:
name: APT ${{ matrix.image }} PG${{ matrix.pg }} ${{ matrix.license }}
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false
matrix:
# Debian images: 10 (buster), 11 (bullseye), 12 (bookworm)
# Ubuntu images: 18.04 LTS (bionic), 20.04 LTS (focal), 21.10 (impish), 22.04 (jammy), 22.10 (kinetic)
image: [ "debian:10-slim", "debian:11-slim", "debian:12-slim", "ubuntu:focal", "ubuntu:jammy", "ubuntu:kinetic"]
pg: [ 13, 14, 15 ]
license: [ "TSL", "Apache"]
include:
- license: Apache
pkg_suffix: "-oss"
steps:
- name: Add repositories
run: |
apt-get update
apt-get install -y wget lsb-release gnupg apt-transport-https sudo postgresql-common
yes | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
image_type=$(lsb_release -i -s | tr '[:upper:]' '[:lower:]')
echo "deb https://packagecloud.io/timescale/timescaledb/${image_type}/ $(lsb_release -c -s) main" \
> /etc/apt/sources.list.d/timescaledb.list
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -
- name: Install timescaledb
run: |
apt-get update
apt-get install -y --no-install-recommends \
timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} timescaledb-tools
timescaledb-tune --quiet --yes
- name: List available versions
run: |
apt-cache show timescaledb-2${{ matrix.pkg_suffix }}-postgresql-${{ matrix.pg }} \
| grep -e Version: -e Depends: | tr '\n' ' ' | sed -e 's! Version: !\n!g' -e 's!Version: !!' -e 's!$!\n!'
- name: Show files in package
run: |
dpkg -L 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: |
pg_ctlcluster ${{ matrix.pg }} main start
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
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 = !!')
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
- name: PostgreSQL log
if: always()
run: |
cat /var/log/postgresql/postgresql-${{ matrix.pg }}-main.log