Support Test and CI #2
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: Test Ubuntu | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
pull_request: | |
branches: | |
- master | |
- develop | |
workflow_dispatch: | |
jobs: | |
test-ubuntu: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
psql: [12, 16] | |
postgis: [3] | |
os: [ubuntu-24.04, ubuntu-22.04] | |
steps: | |
- name: Checkout pgGeocoder | |
uses: actions/checkout@v4 | |
- name: get postgres version | |
run: | | |
sudo service postgresql start | |
pgver=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()') | |
echo "PGVER=${pgver}" >> $GITHUB_ENV | |
PGP=5433 | |
if [ "${{ matrix.psql }}" == "${pgver}" ]; then PGP=5432; fi | |
echo "PGPORT=${PGP}" >> $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-${{ matrix.psql }} \ | |
postgresql-${{ matrix.psql }}-pgtap \ | |
postgresql-${{ matrix.psql }}-postgis-${{ matrix.postgis }} \ | |
postgresql-${{ matrix.psql }}-postgis-${{ matrix.postgis }}-scripts | |
- name: Start PostgreSQL | |
run: | | |
sudo service postgresql start | |
- 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: | | |
pg_prove -U postgres -d addresses_test addresses.test.sql | |
pg_prove -U postgres -d addresses_test main.test.sql |