feat: pg_search #422
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
name: Smoke Test Docker Image | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
env: | |
ORG: timescaledev | |
TS_VERSION: main | |
PLATFORM: linux/amd64 | |
jobs: | |
smoketest: | |
name: PG${{ matrix.pg }}-${{ matrix.type }}${{ matrix.oss }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pg: [14, 15, 16] | |
type: ['alpine', 'bitnami'] | |
oss: [ "", "-oss" ] | |
steps: | |
- name: Check out the source | |
uses: actions/checkout@v3 | |
- name: Build Docker Alpine Image | |
if: matrix.type == 'alpine' | |
run: | | |
make image${{ matrix.oss }} PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image PRE_RELEASE=1 TAG_OSS='-t smoketest-image' | |
- name: Build Docker Bitnami Image | |
if: matrix.type == 'bitnami' | |
run: | | |
cd bitnami | |
make image PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image PRE_RELEASE=1 | |
- name: Install psql | |
run: sudo apt install postgresql-client | |
- name: Run the smoke test | |
run: | | |
set -eu | |
export PGHOST=localhost | |
export PGUSER=postgres | |
export PGPASSWORD=test1234 | |
docker container stop smoketest-container || true | |
docker container rm smoketest-container || true | |
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=${PGPASSWORD} --name smoketest-container smoketest-image | |
for _ in {1..120} | |
do | |
if [ -z "$(docker container ls -q --filter name=smoketest-container)" ] | |
then | |
echo "Smoketest container is not running" | |
exit 1 | |
fi | |
if psql -c "select 1" | |
then | |
echo "Test pg_search Extension" | |
psql -c "CREATE EXTENSION pg_search;" | |
# Add pg_search smoke test | |
psql -c "CREATE TABLE test_pg_search_table (id serial PRIMARY KEY, content TEXT);" | |
psql -c "INSERT INTO test_pg_search_table (content) VALUES ('This is a test document'), ('Another test document');" | |
psql -c "SELECT * FROM pg_search_content('test', 'test_pg_search_table', 'content');" | |
echo "Test pg_cron Extension" | |
psql -c "CREATE EXTENSION pg_cron"; | |
psql -c "SELECT cron.schedule('30 3 * * 6',\$\$DELETE FROM events WHERE event_time < now() - interval '1 week'\$\$)"; | |
echo "Test PostGIS Extension" | |
psql -c "CREATE EXTENSION postgis;" || true | |
psql -c "SELECT PostGIS_Version();" | |
echo "Test PostGIS Geometry Function" | |
psql -c "CREATE TABLE test_geometry_table (id serial primary key, geom geometry(Point, 4326));" | |
psql -c "INSERT INTO test_geometry_table (geom) VALUES (ST_GeomFromText('POINT(0 0)', 4326));" | |
psql -c "SELECT * FROM test_geometry_table;" | |
echo "Test HyperLogLog Extension" | |
psql -c "CREATE EXTENSION hll;" | |
psql -c "select hll_hash_text('hello world');" | |
echo "Test Citus Extension" | |
psql -c "CREATE EXTENSION citus;" | |
psql -c "SELECT * FROM citus_version();" | |
echo "Test Citus Distributed Table" | |
psql -c "CREATE TABLE test_distributed_table (id serial primary key, data text);" | |
psql -c "SELECT create_distributed_table('test_distributed_table', 'id');" | |
psql -c "INSERT INTO test_distributed_table (data) VALUES ('test data');" | |
psql -c "SELECT * FROM test_distributed_table;" | |
echo "Test pg_repack Extension" | |
psql -c "CREATE EXTENSION pg_repack;" | |
psql -c "select repack.version(), repack.version_sql();" | |
echo "Test pgautofailover Extension" | |
psql -c "CREATE EXTENSION pgautofailover CASCADE;" | |
psql -c "SELECT pgautofailover.formation_settings();" | |
echo "Test pg_jobmon Extension" | |
psql -c " CREATE SCHEMA jobmon;" | |
psql -c "CREATE EXTENSION pg_jobmon SCHEMA jobmon cascade;" | |
echo "Test pg_partman Extension" | |
psql -c "CREATE SCHEMA partman;" | |
psql -c "CREATE EXTENSION pg_partman SCHEMA partman;" | |
break | |
fi | |
sleep 1 | |
done | |
if ! psql -c "select 1" | |
then | |
echo "Cannot connect to PostgreSQL" | |
exit 1 | |
fi | |
- name: Show the logs | |
if: always() | |
run: | | |
docker logs smoketest-container |