Skip to content

165: Include dataset for ElasticSearch #57

165: Include dataset for ElasticSearch

165: Include dataset for ElasticSearch #57

Workflow file for this run

name: Test Go Code
on:
pull_request:
branches:
- main
- master
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:15-3.3
env:
POSTGRES_PASSWORD: root
POSTGRES_DB: vn_provinces_tmp
POSTGRES_USER: postgres
ports:
- 15432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
- name: Download dependencies
working-directory: ./dataset-generation-scripts
run: go mod download
- name: Initialize database
env:
PGPASSWORD: root
run: |
sudo apt-get update && sudo apt-get install -y postgresql-client
sleep 5
psql -h localhost -p 15432 -U postgres -d vn_provinces_tmp -c "CREATE EXTENSION IF NOT EXISTS postgis;" || true
psql -h localhost -p 15432 -U postgres -d vn_provinces_tmp -a -f dataset-generation-scripts/resources/db_table_init.sql || true
psql -h localhost -p 15432 -U postgres -d vn_provinces_tmp -a -f dataset-generation-scripts/resources/db_region_administrative_unit.sql || true
psql -h localhost -p 15432 -U postgres -d vn_provinces_tmp -a -f dataset-generation-scripts/resources/gis/sapnhap_bando_tables.sql || true
psql -h localhost -p 15432 -U postgres -d vn_provinces_tmp -a -f dataset-generation-scripts/resources/gis/sapnhapbando_init_geo_json_objects_tbl.sql || true
- name: Run tests
working-directory: ./dataset-generation-scripts
env:
POSTGRES_DB_HOST: localhost
POSTGRES_DB_PORT: 15432
POSTGRES_DB_USERNAME: postgres
POSTGRES_DB_PSWD: root
POSTGRES_TMP_DB_NAME: vn_provinces_tmp
run: go test -v ./...