Skip to content

Instantly share code, notes, and snippets.

@dmlittle
Created May 29, 2021 04:50
Show Gist options
  • Save dmlittle/66ba7b8d4f27a25ae5ecd1d006ac44ca to your computer and use it in GitHub Desktop.
Save dmlittle/66ba7b8d4f27a25ae5ecd1d006ac44ca to your computer and use it in GitHub Desktop.
GitHub Actions Postgres service container example
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.5
env:
POSTGRES_DB: "test"
POSTGRES_PASSWORD: ""
POSTGRES_USER: "admin"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15.2
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Run Tests
run: make test_ci
- name: Run Linter
run: make lint
# Redacted the rest of the GitHub Action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment