-
Notifications
You must be signed in to change notification settings - Fork 3
80 lines (65 loc) · 2.06 KB
/
ci.yaml
File metadata and controls
80 lines (65 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: CI
env:
# Database to connect to that can create other databases with `CREATE DATABASE`.
ADMIN_DATABASE_URL: postgres://postgres:postgres@localhost:5432
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/river_test?pool_max_conns=15&sslmode=disable
on:
push:
branches:
- master
pull_request:
jobs:
build_and_test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 2s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: "go.work"
- name: Display Go version
run: go version
- name: Set up database
run: psql -c "CREATE DATABASE river_test" $ADMIN_DATABASE_URL
- name: Test
run: make test
golangci-lint:
runs-on: ubuntu-latest
env:
GOLANGCI_LINT_VERSION: v2.11.4
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
check-latest: true
go-version-file: "go.work"
- name: Lint
uses: golangci/golangci-lint-action@v7
with:
# golangci-lint needs to be run separately for every Go module, and
# its GitHub Action doesn't provide any way to do that. Have it fetch
# the golangci-lint binary, trick it into not running by sending only
# `--help`, then run the full set of lints below. DO NOT run separate
# modules as separate golangci-lint-action steps. Its post run caching
# can be extremely slow, and that's amplified in a very painful way if
# it needs to be run multiple times.
args: --help
version: ${{ env.GOLANGCI_LINT_VERSION }}
- name: Run lint
run: make lint