Created
May 29, 2021 04:50
-
-
Save dmlittle/66ba7b8d4f27a25ae5ecd1d006ac44ca to your computer and use it in GitHub Desktop.
GitHub Actions Postgres service container example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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