update deps #14
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: Setup PostgreSQL and test fitbit_pgdb | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
services: | |
postgres: | |
# Docker Hub image | |
image: postgres:14.5 | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: pass | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Go environment | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
- name: build | |
run: go build -v ./... | |
- name: test | |
env: | |
POSTGRES_HOST: localhost | |
DB_USER: fitbit | |
DB_PASS: fitbit | |
DB_NAME: fitbit | |
run: | | |
export PGPASSWORD=pass | |
psql -h localhost -p 5432 -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" -U postgres | |
psql -h localhost -p 5432 -c "CREATE DATABASE $DB_NAME OWNER $DB_USER;" -U postgres | |
go test -v ./... |