forked from mbasa/pgGeocoder
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 2.14 KB
/
test-ubuntu.yml
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
name: Test Ubuntu
on:
push:
workflow_dispatch:
jobs:
test-ubuntu:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04]
steps:
- name: Checkout pgGeocoder
uses: actions/checkout@v4
- name: Set PostgreSQL/PostGIS major version
run: |
pg_major=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
echo "PG_MAJOR=${pg_major}" >> $GITHUB_ENV
echo "POSTGIS_MAJOR=3" >> $GITHUB_ENV
- name: Add PostgreSQL APT repository
run: |
sudo apt-get install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ \
$(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libtap-parser-sourcehandler-pgtap-perl \
postgresql-${PG_MAJOR} \
postgresql-${PG_MAJOR}-pgtap \
postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR} \
postgresql-${PG_MAJOR}-postgis-${POSTGIS_MAJOR}-scripts
- name: Start PostgreSQL (with trust authentication)
run: |
sudo sed -i "s/\(peer\|scram-sha-256\)$/trust/g" "/etc/postgresql/${PG_MAJOR}/main/pg_hba.conf"
sudo cat "/etc/postgresql/${PG_MAJOR}/main/pg_hba.conf"
sudo systemctl start postgresql.service
- name: Wait PostgreSQL launch
run: |
pg_isready -U postgres -h localhost -p 5432
psql -U postgres -h localhost -p 5432 -c "SELECT version();"
- name: Set up database
run: |
cp .env.example .env
cp tests/.env.test tests/.env
bash tests/create_test_db_from_fixtures.sh
- name: Run test
run: |
cd tests/normalize-japanese-addresses
pg_prove -U postgres -h localhost -p 5432 -d addresses_test addresses.test.sql
pg_prove -U postgres -h localhost -p 5432 -d addresses_test main.test.sql