From fca961d185ef42f5be8b8feb54a55c028080154d Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Wed, 10 Feb 2021 15:15:23 -0800 Subject: [PATCH] Add GitHub Actions CI --- .github/workflows/ci.yml | 54 ++++++++++++++++++++++++++++++++++++++++ expected/http.out | 14 +++++------ sql/http.sql | 10 ++++---- 3 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..025750a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +# GitHub Actions for PostGIS +# +# Paul Ramsey + +name: "CI" +on: [push, pull_request] + +jobs: + linux: + + env: + OS_VERSION: ubuntu-20.04 + OS_PGNAME: focal-pgdg + OS_PGVER: 13 + + name: "CI" + strategy: + matrix: + ci: + - { PG_VERSION: 10 } + - { PG_VERSION: 11 } + - { PG_VERSION: 12 } + - { PG_VERSION: 13 } + + runs-on: ubuntu-20.04 + + steps: + + - name: 'Check Out' + uses: actions/checkout@v2 + + - name: 'Install' + run: | + export PG_VERSION=${{ matrix.ci.PG_VERSION }} + sudo /etc/init.d/postgresql stop + + sudo apt-get -y --purge remove postgresql postgresql-common postgresql-$OS_PGVER postgresql-server-dev-$OS_PGVER postgresql-client-common postgresql-client-$OS_PGVER libpq-dev + sudo apt-get -y autoremove + sudo rm -rf /var/lib/postgresql + curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ $OS_PGNAME main $PG_VERSION" + sudo apt-get -y install libcurl4-gnutls-dev postgresql-$PG_VERSION postgresql-client-$PG_VERSION postgresql-server-dev-$PG_VERSION + sudo cp ./ci/pg_hba.conf /etc/postgresql/$PG_VERSION/main/pg_hba.conf + sudo /etc/init.d/postgresql stop + sudo /etc/init.d/postgresql start + + - name: 'Build & Test' + run: | + export PATH=/usr/lib/postgresql/${{ matrix.ci.PG_VERSION }}/bin/:$PATH + make + sudo make install + PGUSER=postgres PGPORT=5432 make installcheck || (cat regression.diffs && /bin/false) + + diff --git a/expected/http.out b/expected/http.out index 6741df2..cf748d0 100644 --- a/expected/http.out +++ b/expected/http.out @@ -15,15 +15,15 @@ FROM http_get('https://httpbin.org/status/202'); (1 row) -- Headers -SELECT * +SELECT lower(field) AS field, value FROM ( SELECT (unnest(headers)).* FROM http_get('https://httpbin.org/response-headers?Abcde=abcde') ) a -WHERE field = 'Abcde'; +WHERE field ILIKE 'Abcde'; field | value -------+------- - Abcde | abcde + abcde | abcde (1 row) -- GET @@ -107,15 +107,15 @@ FROM http_post('https://httpbin.org/anything?foo=bar','payload','text/plain'); (1 row) -- HEAD -SELECT * +SELECT lower(field) AS field, value FROM ( SELECT (unnest(headers)).* FROM http_head('https://httpbin.org/response-headers?Abcde=abcde') ) a -WHERE field = 'Abcde'; +WHERE field ILIKE 'Abcde'; field | value -------+------- - Abcde | abcde + abcde | abcde (1 row) -- Follow redirect @@ -141,7 +141,7 @@ SELECT length(textsend(http.content)) AS length_binary, headers.value AS length_headers FROM http, headers -WHERE field = 'Content-Length'; +WHERE field ILIKE 'Content-Length'; content_type | length_binary | length_headers --------------+---------------+---------------- image/png | 8090 | 8090 diff --git a/sql/http.sql b/sql/http.sql index 0731d27..d22ed48 100644 --- a/sql/http.sql +++ b/sql/http.sql @@ -8,12 +8,12 @@ SELECT status FROM http_get('https://httpbin.org/status/202'); -- Headers -SELECT * +SELECT lower(field) AS field, value FROM ( SELECT (unnest(headers)).* FROM http_get('https://httpbin.org/response-headers?Abcde=abcde') ) a -WHERE field = 'Abcde'; +WHERE field ILIKE 'Abcde'; -- GET SELECT status, @@ -62,12 +62,12 @@ content::json->'method' AS method FROM http_post('https://httpbin.org/anything?foo=bar','payload','text/plain'); -- HEAD -SELECT * +SELECT lower(field) AS field, value FROM ( SELECT (unnest(headers)).* FROM http_head('https://httpbin.org/response-headers?Abcde=abcde') ) a -WHERE field = 'Abcde'; +WHERE field ILIKE 'Abcde'; -- Follow redirect SELECT status, @@ -88,7 +88,7 @@ SELECT length(textsend(http.content)) AS length_binary, headers.value AS length_headers FROM http, headers -WHERE field = 'Content-Length'; +WHERE field ILIKE 'Content-Length'; -- Alter options and and reset them and throw errors SELECT http_set_curlopt('CURLOPT_PROXY', '127.0.0.1');