pgweb/.github/workflows/checks.yml
Dan Sosedoff 4c40eef99a
Perform client version validation before executing pg_dump command (#614)
* Add func to parse out pg_dump version
* Perform client vs server version checking before dump exports
* Fix dump tests
* Add extra test to validate against empty server version
* Fix attachment filenames cleanup function
* Add extra test
* Fix small typos in comments
* Drop third-party package to deal with versions
* Tweak the pg dump incompatibility error message
* Run CI on pull requests
2022-12-12 15:09:12 -06:00

97 lines
2.0 KiB
YAML

name: checks
on:
- push
- pull_request
env:
GO_VERSION: 1.19
CGO_ENABLED: 0
jobs:
tests:
name: tests
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
pg_version: [12, 13, 14]
services:
postgres:
image: postgres:${{ matrix.pg_version }}
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: booktown
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- run: go mod download
- run: make test
env:
MallocNanoZone: 0 # https://github.com/golang/go/issues/49138
CGO_ENABLED: 1
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: booktown
tests-windows:
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- run: go mod download
- run: make test
env:
CGO_ENABLED: 1
lint:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.1
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- run: go mod download
- run: script/check_formatting.sh