Skip to content

Add email login template #50

Add email login template

Add email login template #50

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: speedyauth
# 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
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Install golang-migrate
run: |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.16.2/migrate.linux-amd64.tar.gz | tar xvz
sudo mv migrate /usr/bin/
which migrate
- name: "Populate some data"
env:
PGPASSWORD: postgres
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends postgresql-client
psql -h localhost -U postgres -d speedyauth < db/sample_data.sql
- name: "Run DB migrations"
run: |
migrate -source file://db/migrations -database 'postgres://postgres:postgres@localhost:5432/speedyauth?sslmode=disable' up
- name: Build
run: go build -v ./...
- name: Test
env:
PG_HOST: localhost
PG_USER: postgres
PG_PASSWORD: postgres
PG_PORT: 5432
PG_DB: speedyauth
run: go test -v ./...