Skip to content

Commit

Permalink
init workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
qnnn committed Jan 31, 2024
1 parent 098d263 commit 0a67154
Show file tree
Hide file tree
Showing 9 changed files with 835 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment**
- Version: [e.g. v1.0.0]
- OS: [e.g. CentOS8]

**Additional context**
Add any other context about the problem here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Documentation
about: Improvements or additions to documentation
title: ''
labels: documentation
assignees: ''

---


17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**What is the feature you want to add?**

**Why do you want to add this feature?**

**How to implement this feature?**

**Additional context**
Add any other context or screenshots about the feature request here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/q-a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Q&A
about: Please tell me your questions
title: ''
labels: question
assignees: ''

---


62 changes: 62 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# 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: golangci-lint
on:
push:
branches:
- main
- release*
pull_request:
branches:
- main
- release*
- feature/**
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false

jobs:
golangci:
strategy:
matrix:
go-version: [ "1.21.5" ]
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/[email protected]
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
args: --timeout=30m
187 changes: 187 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
# 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*
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false

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
steps:
# Setup the environment.
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21.5"
# Checkout latest code
- name: Checkout repo
uses: actions/checkout@v2

- name: Initialize database
env:
MYSQL_DB_USER: root
MYSQL_DB_PWD: root
MYSQL_DATABASE: polaris_server
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PWD }}
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 }}
# Compile
- name: Build And Test
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
MYSQL_DB_USER: root
MYSQL_DB_PWD: root
REDIS_ADDR: 127.0.0.1:6379
REDIS_PWD:
run: |
workir=$(pwd)
export STORE_MODE=sqldb
export MYSQL_DB_USER=${{ env.MYSQL_DB_USER }}
export MYSQL_DB_PWD=${{ env.MYSQL_DB_PWD }}
echo "cur STORE MODE=${STORE_MODE}"
polaris_server_tag=v1.18.0-beta.1
# 设置严格模式
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'";
# 清空数据
mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "DROP DATABASE IF EXISTS polaris_server";
# 初始化 polaris 数据库
mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" < store/mysqlopt/scripts/polaris_server.sql
# 临时放开 DB 的最大连接数
mysql -h127.0.0.1 -P3306 -u${{ env.MYSQL_DB_USER }} -p"${{ env.MYSQL_DB_PWD }}" -e "set GLOBAL max_connections = 3000;"
## 清理之前的临时资源
rm -rf build_resource
## 准备临时构建资源文件夹
mkdir build_resource
cp plugin_store_mysql_opt.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_mysql_opt.go.temp >plugin_store_mysql_opt.go
go clean --modcache
go get github.com/polaris-contrib/store-mysqlopt
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"
cp -rf ${workir}/test/data/polaris-server.yaml ${workir}/build_resource/polaris/${server_install_dir}
cd ${workir}/build_resource/polaris/${server_install_dir}
ls -alR
chmod +x ./tool/*.sh
./tool/start.sh
sleep 120s
ls -alR
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 ${workir}/build_resource/polaris/${server_install_dir}
./tool/stop.sh
cd ..
59 changes: 59 additions & 0 deletions .github/workflows/licence-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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: License checker

on:
push:
branches:
- main
- release*
pull_request:
branches:
- main
- release*
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Tags'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: false

jobs:
check-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Check License Header
uses: apache/skywalking-eyes@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
log: info
config: .licenserc.yaml
Loading

0 comments on commit 0a67154

Please sign in to comment.