pgweb/.github/workflows/checks.yml

114 lines
2.6 KiB
YAML
Raw Normal View History

2021-12-25 11:31:41 -06:00
name: checks
on:
2022-12-16 15:03:06 -06:00
push:
branches:
- main
2022-12-16 15:03:06 -06:00
paths-ignore:
- '**.md'
pull_request:
types:
- opened
- synchronize
paths-ignore:
- '**.md'
2021-12-25 11:31:41 -06:00
env:
2024-03-22 21:03:07 -07:00
GO_VERSION: "1.22"
2021-12-25 11:31:41 -06:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2021-12-25 11:31:41 -06:00
jobs:
tests:
name: tests
runs-on: ubuntu-latest
2023-09-26 23:22:59 -05:00
timeout-minutes: 40
strategy:
matrix:
pg_version: [9.6, 10, 11, 12, 13, 14, 15, 16, 17]
2021-12-25 11:31:41 -06:00
services:
postgres:
image: postgres:${{ matrix.pg_version }}
2021-12-25 11:31:41 -06:00
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:
- name: Install latest Postgres client
run: |
sudo rm -f /etc/apt/sources.list.d/pgdg.list
curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update && sudo apt-get install -y postgresql-client-17
2022-11-14 16:14:50 -06:00
- uses: actions/checkout@v3
2021-12-25 11:31:41 -06:00
with:
fetch-depth: 0
2022-11-14 16:14:50 -06:00
- uses: actions/setup-go@v3
2021-12-25 11:31:41 -06:00
with:
go-version: ${{ env.GO_VERSION }}
- run: go mod download
- run: make test
env:
MallocNanoZone: 0 # https://github.com/golang/go/issues/49138
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
2022-11-14 15:49:30 -06:00
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.57.1
2022-11-14 15:49:30 -06:00
2021-12-25 11:31:41 -06:00
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
2022-11-14 16:14:50 -06:00
- uses: actions/checkout@v3
2021-12-25 11:31:41 -06:00
with:
fetch-depth: 0
2022-11-14 16:14:50 -06:00
- uses: actions/setup-go@v3
2021-12-25 11:31:41 -06:00
with:
go-version: ${{ env.GO_VERSION }}
- run: go mod download
- run: script/check_formatting.sh