-
Notifications
You must be signed in to change notification settings - Fork 1
179 lines (153 loc) · 5.3 KB
/
integration.yaml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# Tencent is pleased to support the open source community by making Polaris available.
#
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
name: Integration
on:
push:
branches:
- main
- release*
pull_request:
branches:
- main
- release*
permissions:
contents: write
# Always force the use of Go modules
env:
GO111MODULE: on
jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest ]
goarch: [ amd64 ]
goos: [ linux ]
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
vert: 1
exclude:
- os: ubuntu-latest
goos: windows
- os: ubuntu-latest
goos: darwin
- os: windows-latest
goos: linux
- os: windows-latest
goos: darwin
- os: macos-latest
goos: windows
- os: macos-latest
goos: linux
runs-on: ${{ matrix.os }}
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Setup the environment.
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.19
# Checkout latest code
- name: Checkout repo
uses: actions/checkout@v2
- name: Initialize Database
run: |
# 此处暂时先手动操作,初始化sql
# 1、初始化postgresql文件地址:store/postgresql/scripts/polaris_server.sql
# 2、手动通过postgresql客户端导入初始化数据
# Compile
- name: Build And Test
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
workir=$(pwd)
export STORE_MODE=sqldb
echo "cur STORE MODE=${STORE_MODE}"
## repo_full_name=${{github.event.pull_request.head.repo.full_name}}
## echo "bianliang-${{github.event.pull_request}}-111111111-${{toJson(github)}}"
## head_sha=${{github.event.pull_request.head.sha}}
polaris_server_tag=v1.17.2
## 清理之前的临时资源
rm -rf build_resource
## 准备临时构建资源文件夹
mkdir build_resource
cp plugin_store_pg.go.temp ./build_resource
cd build_resource
git clone https://github.com/polarismesh/polaris.git
cd polaris
if [ "${polaris_server_tag}" != "" ]; then
git checkout ${polaris_server_tag}
fi
cat ../plugin_store_pg.go.temp >plugin_store_pg.go
go clean --modcache
go get -u github.com/polaris-contrib/store-postgresql
## go mod edit -replace=github.com/polaris-contrib/store-postgresql=github.com/"${{github.event.pull_request.head.repo.full_name}}"@"${{github.event.pull_request.head.sha}}"
go mod tidy
make build VERSION=${polaris_server_tag}
# 找构建好的 server 安装目录
server_install_dir=$(ls | grep polaris-server-release | sed -n '1p')
echo "server_install_dir is $server_install_dir"
echo "1111111111111"
cp -rf ${workir}/test/data/polaris-server.yaml ${workir}/build_resource/polaris/${server_install_dir}
cd ${workir}/build_resource/polaris/${server_install_dir}
echo "2222222222222"
ls -alR
chmod +x ./tool/*.sh
./tool/start.sh
echo "33333333333"
sleep 120s
ls -alR
cat ./log/stdout 2>&1
echo "444444444444"
cd ..
ls -lstrh
# 先测试普通的集成测试
pushd ${workir}/build_resource/polaris/test/integrate
echo "[INTEGRATION TEST] begin"
curl http://127.0.0.1:8090
go test -count=1 -v -tags integration -timeout 60m
echo "[INTEGRATION TEST] end"
popd
cd $work_dir
./tool/stop.sh
cd ..