Skip to content

Instantly share code, notes, and snippets.

@chris
Created July 7, 2020 20:44
Show Gist options
  • Select an option

  • Save chris/a7cd07f54d06b3cfbd137cc4f578131b to your computer and use it in GitHub Desktop.

Select an option

Save chris/a7cd07f54d06b3cfbd137cc4f578131b to your computer and use it in GitHub Desktop.
Example of trying to get CircleCI with Postgres, PostGIS and psql working
# Golang CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-go/ for more details
version: 2
jobs:
build:
docker:
# specify the version
- image: cimg/go:1.14
environment:
CI_DATABASE_URL: postgresql://postgres@localhost/your_test_db_name
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# Service container image available at `host: localhost`
- image: circleci/postgres:10.7-postgis
environment:
POSTGRES_USER: postgres
POSTGRES_DB: your_test_db_name
#### TEMPLATE_NOTE: go expects specific checkout path representing url
#### expecting it in the form of
#### /go/src/github.com/circleci/go-tool
#### /go/src/bitbucket.org/circleci/go-tool
steps:
- checkout
- run: sudo apt-get update
- run: sudo apt-get install postgresql-client
- run:
name: Setup DB
working_directory: ./test/data
environment:
TERM: xterm
command: psql -q -d $CI_DATABASE_URL -f your_seed_data.sql
- run:
name: Test some Go code
working_directory: ./go/somemodule
command: go test
environment:
CI_DATABASE_URL: postgresql://postgres@localhost/your_test_db_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment