2021-07-14 19:22:49 +00:00
|
|
|
on: [push, pull_request]
|
|
|
|
name: Unit Tests
|
|
|
|
jobs:
|
|
|
|
test:
|
2022-11-16 18:29:25 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-07 16:37:21 +00:00
|
|
|
env:
|
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost/apollo_test
|
2023-04-01 16:10:08 +00:00
|
|
|
REDIS_URL: redis://localhost:6379
|
2022-05-07 16:37:21 +00:00
|
|
|
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
|
2023-04-01 15:57:28 +00:00
|
|
|
redis:
|
|
|
|
image: redis
|
|
|
|
options: >-
|
|
|
|
--health-cmd "redis-cli ping"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2021-07-14 19:22:49 +00:00
|
|
|
steps:
|
2022-11-16 18:29:25 +00:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-go@v3
|
2021-07-14 19:26:51 +00:00
|
|
|
with:
|
2023-04-01 16:12:18 +00:00
|
|
|
go-version: 1.20.2
|
2022-11-16 18:29:25 +00:00
|
|
|
- uses: golangci/golangci-lint-action@v3
|
|
|
|
- run: psql -f docs/schema.sql $DATABASE_URL
|
|
|
|
- run: go test ./... -v -race -timeout 5s
|