version: pgtestdb/migrators/* -> v0.0.12 #66
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: golang | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
test: | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_PASSWORD: password | |
# TODO: unable to turn off fsync easily, see | |
# https://github.com/orgs/community/discussions/26688#discussioncomment-3252882 | |
# and | |
# https://github.com/actions/runner/discussions/1872 | |
ports: | |
- 5433:5432 | |
# Use a temporary directory for data by passing --mount to the `docker` | |
# command; could also attempt to use the volumes: github serrvice | |
# option. | |
options: >- | |
--mount type=tmpfs,destination=/var/lib/postgresql/data | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
cache: true | |
cache-dependency-path: go.sum | |
- name: install atlas CLI | |
run: curl -sSf https://atlasgo.sh | sh | |
- name: test all | |
run: go test github.com/peterldowns/pgtestdb/... | |
- name: test all -race | |
run: go test -race github.com/peterldowns/pgtestdb/... | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
cache: true | |
cache-dependency-path: go.sum | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.52.2 | |
- name: go mod tidy | |
run: go mod tidy | |
- name: check for any changes | |
run: | | |
[[ $(git status --porcelain) == "" ]] || (echo "changes detected" && exit 1) |