Skip to content

Commit 0a67154

Browse files
committed
init workflows
1 parent 098d263 commit 0a67154

File tree

9 files changed

+835
-0
lines changed

9 files changed

+835
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior.
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Environment**
20+
- Version: [e.g. v1.0.0]
21+
- OS: [e.g. CentOS8]
22+
23+
**Additional context**
24+
Add any other context about the problem here.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Documentation
3+
about: Improvements or additions to documentation
4+
title: ''
5+
labels: documentation
6+
assignees: ''
7+
8+
---
9+
10+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**What is the feature you want to add?**
11+
12+
**Why do you want to add this feature?**
13+
14+
**How to implement this feature?**
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.github/ISSUE_TEMPLATE/q-a.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Q&A
3+
about: Please tell me your questions
4+
title: ''
5+
labels: question
6+
assignees: ''
7+
8+
---
9+
10+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Tencent is pleased to support the open source community by making Polaris available.
2+
#
3+
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4+
#
5+
# Licensed under the BSD 3-Clause License (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://opensource.org/licenses/BSD-3-Clause
10+
#
11+
# Unless required by applicable law or agreed to in writing, software distributed
12+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
14+
# specific language governing permissions and limitations under the License.
15+
16+
name: golangci-lint
17+
on:
18+
push:
19+
branches:
20+
- main
21+
- release*
22+
pull_request:
23+
branches:
24+
- main
25+
- release*
26+
- feature/**
27+
workflow_dispatch:
28+
inputs:
29+
logLevel:
30+
description: 'Log level'
31+
required: true
32+
default: 'warning'
33+
type: choice
34+
options:
35+
- info
36+
- warning
37+
- debug
38+
tags:
39+
description: 'Tags'
40+
required: false
41+
type: boolean
42+
environment:
43+
description: 'Environment to run tests against'
44+
type: environment
45+
required: false
46+
47+
jobs:
48+
golangci:
49+
strategy:
50+
matrix:
51+
go-version: [ "1.21.5" ]
52+
name: golangci-lint
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/setup-go@v3
56+
- uses: actions/checkout@v3
57+
- name: golangci-lint
58+
uses: golangci/[email protected]
59+
with:
60+
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
61+
version: latest
62+
args: --timeout=30m

.github/workflows/integration.yaml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# Tencent is pleased to support the open source community by making Polaris available.
2+
#
3+
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4+
#
5+
# Licensed under the BSD 3-Clause License (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://opensource.org/licenses/BSD-3-Clause
10+
#
11+
# Unless required by applicable law or agreed to in writing, software distributed
12+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
14+
# specific language governing permissions and limitations under the License.
15+
16+
name: Integration
17+
18+
on:
19+
push:
20+
branches:
21+
- main
22+
- release*
23+
pull_request:
24+
branches:
25+
- main
26+
- release*
27+
workflow_dispatch:
28+
inputs:
29+
logLevel:
30+
description: 'Log level'
31+
required: true
32+
default: 'warning'
33+
type: choice
34+
options:
35+
- info
36+
- warning
37+
- debug
38+
tags:
39+
description: 'Tags'
40+
required: false
41+
type: boolean
42+
environment:
43+
description: 'Environment to run tests against'
44+
type: environment
45+
required: false
46+
47+
permissions:
48+
contents: write
49+
50+
# Always force the use of Go modules
51+
env:
52+
GO111MODULE: on
53+
54+
jobs:
55+
build:
56+
strategy:
57+
matrix:
58+
os: [ ubuntu-latest ]
59+
goarch: [ amd64 ]
60+
goos: [ linux ]
61+
include:
62+
- os: ubuntu-latest
63+
goos: linux
64+
goarch: amd64
65+
vert: 1
66+
exclude:
67+
- os: ubuntu-latest
68+
goos: windows
69+
- os: ubuntu-latest
70+
goos: darwin
71+
- os: windows-latest
72+
goos: linux
73+
- os: windows-latest
74+
goos: darwin
75+
- os: macos-latest
76+
goos: windows
77+
- os: macos-latest
78+
goos: linux
79+
80+
runs-on: ${{ matrix.os }}
81+
services:
82+
# Label used to access the service container
83+
redis:
84+
# Docker Hub image
85+
image: redis
86+
# Set health checks to wait until redis has started
87+
options: >-
88+
--health-cmd "redis-cli ping"
89+
--health-interval 10s
90+
--health-timeout 5s
91+
--health-retries 5
92+
ports:
93+
# Maps port 6379 on service container to the host
94+
- 6379:6379
95+
steps:
96+
# Setup the environment.
97+
- name: Setup Go
98+
uses: actions/setup-go@v4
99+
with:
100+
go-version: "1.21.5"
101+
# Checkout latest code
102+
- name: Checkout repo
103+
uses: actions/checkout@v2
104+
105+
- name: Initialize database
106+
env:
107+
MYSQL_DB_USER: root
108+
MYSQL_DB_PWD: root
109+
MYSQL_DATABASE: polaris_server
110+
run: |
111+
sudo systemctl start mysql.service
112+
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }}
113+
mysql -e "ALTER USER '${{ env.MYSQL_DB_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }}
114+
115+
# Compile
116+
- name: Build And Test
117+
env:
118+
GOOS: ${{ matrix.goos }}
119+
GOARCH: ${{ matrix.goarch }}
120+
MYSQL_DB_USER: root
121+
MYSQL_DB_PWD: root
122+
REDIS_ADDR: 127.0.0.1:6379
123+
REDIS_PWD:
124+
run: |
125+
workir=$(pwd)
126+
export STORE_MODE=sqldb
127+
export MYSQL_DB_USER=${{ env.MYSQL_DB_USER }}
128+
export MYSQL_DB_PWD=${{ env.MYSQL_DB_PWD }}
129+
echo "cur STORE MODE=${STORE_MODE}"
130+
polaris_server_tag=v1.18.0-beta.1
131+
# 设置严格模式
132+
mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "set sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'";
133+
# 清空数据
134+
mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "DROP DATABASE IF EXISTS polaris_server";
135+
# 初始化 polaris 数据库
136+
mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" < store/mysqlopt/scripts/polaris_server.sql
137+
# 临时放开 DB 的最大连接数
138+
mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "set GLOBAL max_connections = 3000;"
139+
140+
## 清理之前的临时资源
141+
rm -rf build_resource
142+
143+
## 准备临时构建资源文件夹
144+
mkdir build_resource
145+
cp plugin_store_mysql_opt.go.temp ./build_resource
146+
cd build_resource
147+
148+
git clone https://github.com/polarismesh/polaris.git
149+
cd polaris
150+
if [ "${polaris_server_tag}" != "" ]; then
151+
git checkout ${polaris_server_tag}
152+
fi
153+
154+
cat ../plugin_store_mysql_opt.go.temp >plugin_store_mysql_opt.go
155+
156+
go clean --modcache
157+
go get github.com/polaris-contrib/store-mysqlopt
158+
go mod tidy
159+
160+
make build VERSION=${polaris_server_tag}
161+
162+
# 找构建好的 server 安装目录
163+
server_install_dir=$(ls | grep polaris-server-release | sed -n '1p')
164+
echo "server_install_dir is $server_install_dir"
165+
166+
cp -rf ${workir}/test/data/polaris-server.yaml ${workir}/build_resource/polaris/${server_install_dir}
167+
cd ${workir}/build_resource/polaris/${server_install_dir}
168+
169+
ls -alR
170+
chmod +x ./tool/*.sh
171+
./tool/start.sh
172+
173+
sleep 120s
174+
ls -alR
175+
176+
cd ..
177+
ls -lstrh
178+
# 先测试普通的集成测试
179+
pushd ${workir}/build_resource/polaris/test/integrate
180+
echo "[INTEGRATION TEST] begin"
181+
curl http://127.0.0.1:8090
182+
go test -count=1 -v -tags integration -timeout 60m
183+
echo "[INTEGRATION TEST] end"
184+
popd
185+
cd ${workir}/build_resource/polaris/${server_install_dir}
186+
./tool/stop.sh
187+
cd ..
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Tencent is pleased to support the open source community by making Polaris available.
2+
#
3+
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4+
#
5+
# Licensed under the BSD 3-Clause License (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://opensource.org/licenses/BSD-3-Clause
10+
#
11+
# Unless required by applicable law or agreed to in writing, software distributed
12+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
14+
# specific language governing permissions and limitations under the License.
15+
16+
name: License checker
17+
18+
on:
19+
push:
20+
branches:
21+
- main
22+
- release*
23+
pull_request:
24+
branches:
25+
- main
26+
- release*
27+
workflow_dispatch:
28+
inputs:
29+
logLevel:
30+
description: 'Log level'
31+
required: true
32+
default: 'warning'
33+
type: choice
34+
options:
35+
- info
36+
- warning
37+
- debug
38+
tags:
39+
description: 'Tags'
40+
required: false
41+
type: boolean
42+
environment:
43+
description: 'Environment to run tests against'
44+
type: environment
45+
required: false
46+
47+
jobs:
48+
check-license:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
53+
- name: Check License Header
54+
uses: apache/skywalking-eyes@main
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
log: info
59+
config: .licenserc.yaml

0 commit comments

Comments
 (0)