apollo-backend/.github/workflows/test.yml

43 lines
1014 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