-
Notifications
You must be signed in to change notification settings - Fork 142
108 lines (95 loc) · 3.84 KB
/
go.yml
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Build and run all tests
on:
push:
branches:
- main
pull_request:
jobs:
test:
if: ${{ !(contains(github.head_ref, 'ui/')) || !(contains(github.head_ref, 'cms/')) }}
strategy:
matrix:
go-version: [1.21.x]
os: [ubuntu-latest, macos-latest]
postgres-version: ["15"]
redis-version: ["6.2.6"]
runs-on: ubuntu-latest
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_DB: convoy
POSTGRES_PASSWORD: postgres
POSTGRES_MAX_CONNECTIONS: 2000
# set up health check for postgres
options: --health-cmd pg_isready --health-interval 10ms --health-timeout 500ms --health-retries 15
steps:
- name: Start Redis v${{ matrix.redis-version }}
uses: supercharge/[email protected]
with:
redis-version: ${{ matrix.redis-version }}
redis-port: 6379
- name: Get the version
id: get_version
run: echo ::set-output name=tag::$(echo ${GITHUB_SHA:8})
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Cache go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
restore-keys: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
- name: Check out code
uses: actions/checkout@v4
- name: Get and verify dependencies
run: go mod download && go mod verify
- name: Build app to make sure there are zero issues
run: go build -o convoy ./cmd
- name: Go vet
run: go vet ./...
- name: Migrate Postgres
run: go run ./cmd migrate up
env:
CONVOY_DB_SCHEME: postgres
CONVOY_DB_HOST: localhost
CONVOY_DB_USERNAME: postgres
CONVOY_DB_PASSWORD: postgres
CONVOY_DB_DATABASE: convoy
CONVOY_DB_OPTIONS: sslmode=disable&connect_timeout=30
CONVOY_DB_PORT: 5432
CONVOY_REDIS_SCHEME: redis
CONVOY_REDIS_HOST: localhost
CONVOY_REDIS_PORT: 6379
- name: Run integration tests
run: make integration_tests
env:
TEST_DB_SCHEME: postgres
TEST_DB_HOST: localhost
TEST_DB_USERNAME: postgres
TEST_DB_PASSWORD: postgres
TEST_DB_DATABASE: convoy
TEST_DB_OPTIONS: sslmode=disable&connect_timeout=30
TEST_DB_PORT: 5432
TEST_REDIS_SCHEME: redis
TEST_REDIS_HOST: localhost
TEST_REDIS_PORT: 6379
- name: Run integration tests (with test containers)
run: make docker_e2e_tests
env:
TEST_LICENSE_KEY: ${{ secrets.CONVOY_TEST_LICENSE_KEY }}
TEST_DB_SCHEME: postgres
TEST_DB_HOST: localhost
TEST_DB_USERNAME: postgres
TEST_DB_PASSWORD: postgres
TEST_DB_DATABASE: convoy
TEST_DB_OPTIONS: sslmode=disable&connect_timeout=30
TEST_DB_PORT: 5432
TEST_REDIS_SCHEME: redis
TEST_REDIS_HOST: localhost
TEST_REDIS_PORT: 6379