apollo-backend/.github/workflows/test.yml
André Medeiros f9b9c595cf Better testing (#62)
* some tests

* more tests

* tidy up go.mod

* more tests

* add postgres

* beep

* again

* Set up schema

* fix device test
2022-05-07 12:37:21 -04:00

42 lines
1,014 B
YAML

on: [push, pull_request]
name: Unit Tests
jobs:
test:
name: "go ${{ matrix.go-version }} (${{ matrix.platform }})"
strategy:
matrix:
go-version: [1.18]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
env:
DATABASE_URL: postgres://postgres:postgres@localhost/apollo_test
services:
postgres:
image: postgres
env:
POSTGRES_DB: apollo_test
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Lint
uses: golangci/golangci-lint-action@v2
- name: Setup database schema
run: psql -f docs/schema.sql $DATABASE_URL
- name: Test
run: go test ./... -v -race -timeout 5s