2021-12-25 11:31:41 -06:00
|
|
|
name: checks
|
|
|
|
|
|
|
|
on:
|
2022-12-16 15:03:06 -06:00
|
|
|
push:
|
|
|
|
branches:
|
2024-09-08 08:17:18 -07:00
|
|
|
- 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
|
|
|
|
2022-12-12 18:58:00 -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
|
2022-12-06 17:41:46 -06:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-10-16 20:28:27 -07:00
|
|
|
pg_version: [9.6, 10, 11, 12, 13, 14, 15, 16, 17]
|
2022-12-06 17:41:46 -06:00
|
|
|
|
2021-12-25 11:31:41 -06:00
|
|
|
services:
|
|
|
|
postgres:
|
2022-12-06 17:41:46 -06:00
|
|
|
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:
|
2022-12-12 18:58:00 -06:00
|
|
|
- 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
|
2024-10-16 20:28:27 -07:00
|
|
|
sudo apt-get update && sudo apt-get install -y postgresql-client-17
|
2022-12-12 18:58:00 -06:00
|
|
|
|
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
|
|
|
|
|
2022-12-07 22:17:19 -06:00
|
|
|
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:
|
2024-03-22 20:36:41 -07:00
|
|
|
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
|