github.com/polarismesh/polaris@v1.17.8/.github/workflows/benchmark.yaml (about) 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: Benchmark 17 18 on: 19 push: 20 branches: 21 - main 22 - release* 23 pull_request: 24 branches: 25 - main 26 - release* 27 28 permissions: 29 contents: write 30 31 # Always force the use of Go modules 32 env: 33 GO111MODULE: on 34 35 jobs: 36 build: 37 strategy: 38 matrix: 39 os: [ ubuntu-latest ] 40 goarch: [ amd64 ] 41 goos: [ linux ] 42 include: 43 - os: ubuntu-latest 44 goos: linux 45 goarch: amd64 46 vert: 1 47 exclude: 48 - os: ubuntu-latest 49 goos: windows 50 - os: ubuntu-latest 51 goos: darwin 52 - os: windows-latest 53 goos: linux 54 - os: windows-latest 55 goos: darwin 56 - os: macos-latest 57 goos: windows 58 - os: macos-latest 59 goos: linux 60 61 runs-on: ${{ matrix.os }} 62 steps: 63 # Setup the environment. 64 - name: Setup Go 65 uses: actions/setup-go@v4 66 with: 67 go-version: "1.20" 68 # Checkout latest code 69 - name: Checkout repo 70 uses: actions/checkout@v2 71 72 # Compile 73 - name: Build server 74 env: 75 GOOS: ${{ matrix.goos }} 76 GOARCH: ${{ matrix.goarch }} 77 run: make build 78 79 # Run interface tests 80 - name: run benchmark 81 run: | 82 work_dir=$(ls | grep polaris-server-release | sed -n '1p') 83 echo "work_dir is $work_dir" 84 cd $work_dir 85 86 ls -alR 87 88 if [[ "$(uname)" == "Darwin" ]]; then 89 # Mac OS X 操作系统 90 echo "Run on MacOS" 91 sed -i '' 's/consoleOpen: true/consoleOpen: false/g' conf/polaris-server.yaml 92 else 93 # GNU/Linux操作系统 94 echo "Run on Linux" 95 sed -i 's/consoleOpen: \(true\|false\)/consoleOpen: false/g' conf/polaris-server.yaml 96 fi 97 98 chmod +x ./tool/*.sh 99 ./tool/start.sh 100 101 sleep 120s 102 ls -alR 103 cat ./log/stdout 2>&1 104 105 cd .. 106 ls -lstrh 107 108 echo "[BENCHMARK TEST] begin" 109 export BENCHMARK_SERVER_ADDRESS=127.0.0.1:8091 110 pushd ./test/benchmark/grpc/client 111 go test -v -bench . 112 popd 113 echo "[BENCHMARK TEST] end" 114 cd $work_dir 115 ./tool/stop.sh 116 cd .. 117