-
-
Notifications
You must be signed in to change notification settings - Fork 196
129 lines (113 loc) · 3.54 KB
/
on_pr_push.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: On push
on: [push, pull_request]
jobs:
test:
name: Test on Ubuntu
runs-on: ubuntu-22.04
services:
# label used to access the service container
postgis:
# docker hub image
image: postgis/postgis:12-3.0-alpine
env:
# set the master password for the instance
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Env Debug
run: |
go env
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
- name: Load Postgres test data
env:
TEST_DATA_URL: https://raw.githubusercontent.com/go-spatial/tegola-testdata/master/tegola.dump
TEST_DATA: tegola.backup
PGUSER: postgres
PGHOST: localhost
PGDATABASE: postgres
PGPASSWORD: postgres
run: |
curl ${TEST_DATA_URL} > ${TEST_DATA}
pg_restore -d postgres -C ${TEST_DATA}
psql -c "CREATE ROLE tegola_no_access LOGIN PASSWORD 'postgres'"
rm ${TEST_DATA}
- name: Postgres Debug
env:
PGUSER: postgres
PGHOST: localhost
PGDATABASE: postgres
PGPASSWORD: postgres
run: |
psql -c "\l"
- name: Run tests
env:
# redis tests
RUN_REDIS_TESTS: yes
# AWS S3 tests
RUN_S3_TESTS: yes
AWS_TEST_BUCKET: tegola-ci
AWS_REGION: us-east-2
# PostGIS tests
RUN_POSTGIS_TESTS: yes
PGHOST: localhost
PGPORT: 5432
PGDATABASE: tegola
PGUSER: postgres
PGPASSWORD: postgres
PGUSER_NO_ACCESS: tegola_no_access
PGSSLMODE: disable
PGSSLKEY: ""
PGSSLCERT: ""
PGSSLROOTCERT: ""
# HANA tests
RUN_HANA_TESTS: yes
# The credentials were exposed on purpose
# more information see: https://github.com/go-spatial/tegola/pull/893#discussion_r1136602372
HANA_CONNECTION_STRING: "hdb://TEGOLACI:iZgd6$nOdhf@917df316-4e01-4a10-be54-eac1b6ab15fb.hana.prod-us10.hanacloud.ondemand.com:443?TLSInsecureSkipVerify&TLSServerName=host&timeout=1000&max_connections=10"
run: |
go test -mod vendor -covermode atomic -coverprofile=profile.cov ./...
- name: Send coverage report to Coveralls
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go install -mod=vendor github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github
- name: Build embedded UI
run: |
pushd ${GITHUB_WORKSPACE}/server
go generate ./...
popd
govulncheck:
name: Run govulncheck
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Install and run go vulncheck
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...