From 1ce4efa630691ad96430b3f2aa67f1a3ae1b1aac Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Tue, 19 Dec 2023 14:47:08 +0800 Subject: [PATCH] chore(go-client-ci): build the server instead of downloading it from external site --- .github/workflows/lint_and_test_go-client.yml | 98 ++++++++++++++----- go-client/test.sh | 46 --------- 2 files changed, 76 insertions(+), 68 deletions(-) delete mode 100755 go-client/test.sh diff --git a/.github/workflows/lint_and_test_go-client.yml b/.github/workflows/lint_and_test_go-client.yml index 011ae97c3b..129af9d4e4 100644 --- a/.github/workflows/lint_and_test_go-client.yml +++ b/.github/workflows/lint_and_test_go-client.yml @@ -35,31 +35,85 @@ on: # for manually triggering workflow workflow_dispatch: +env: + ARTIFACT_NAME: release_for_go_client + # workflow tasks jobs: - build: - name: Test and Lint + lint: + name: Lint + # go-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0 + # to generate code as well. The thrift-compiler version on ubuntu-20.04 is 0.13.0 runs-on: ubuntu-20.04 steps: - - name: Install thrift - # go-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0 - # to generate code as well. The thrift-compiler version on ubuntu-20.04 is 0.13.0 - run: sudo apt-get install -y thrift-compiler - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.18 - - name: Run Test - run: ./test.sh - working-directory: ./go-client - - uses: codecov/codecov-action@v2 - with: + - name: Install thrift + run: sudo apt-get install -y thrift-compiler + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Build working-directory: ./go-client - # because some files are generated after building, so lint after that at last - - name: Lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.55.2 + run: make build + # because some files are generated after building, so lint after the build step + - name: Lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.55.2 + working-directory: ./go-client + + build_server: + name: Build server + needs: lint + runs-on: ubuntu-latest + env: + USE_JEMALLOC: OFF + BUILD_OPTIONS: -t release + container: + image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }} + steps: + - uses: actions/checkout@v3 + - uses: "./.github/actions/rebuild_thirdparty_if_needed" + - uses: "./.github/actions/build_pegasus" + - uses: "./.github/actions/upload_artifact" + + test_go_client: + name: Test Go client + needs: build_server + runs-on: ubuntu-latest + container: + image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }} + steps: + # go-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0 + # to generate code as well. The thrift-compiler version on ubuntu-22.04 is 0.16.0, so + # build and install thrift-compiler 0.13.0 manually. + - name: Install thrift + run: | + export THRIFT_VERSION=0.13.0 + wget --progress=dot:giga https://github.com/apache/thrift/archive/refs/tags/v${THRIFT_VERSION}.tar.gz + tar -xzf v${THRIFT_VERSION}.tar.gz + cd thrift-${THRIFT_VERSION} + ./bootstrap.sh + ./configure --enable-libs=no + make -j $(nproc) + make install + cd - && rm -rf thrift-${THRIFT_VERSION} v${THRIFT_VERSION}.tar.gz + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - uses: "./.github/actions/download_artifact" + - name: Start Pegasus cluster + run: | + export LD_LIBRARY_PATH=$(pwd)/thirdparty/output/lib:${JAVA_HOME}/jre/lib/amd64/server + ulimit -s unlimited + ./run.sh start_onebox + - name: Run Go client tests working-directory: ./go-client + run: | + make build + make ci diff --git a/go-client/test.sh b/go-client/test.sh deleted file mode 100755 index 3cd223d42d..0000000000 --- a/go-client/test.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. - -set -e - -SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") -PROJECT_DIR=$(dirname "${SCRIPT_DIR}") -cd "${PROJECT_DIR}" || exit 1 - -PEGASUS_PKG="pegasus-tools-2.0.0-5d969e8-glibc2.12-release" -PEGASUS_PKG_URL="https://github.com/apache/incubator-pegasus/releases/download/v2.0.0/pegasus-tools-2.0.0-5d969e8-glibc2.12-release.tar.gz" - -# start pegasus onebox environment -if [ ! -f $PEGASUS_PKG.tar.gz ]; then - wget --quiet $PEGASUS_PKG_URL - tar xf $PEGASUS_PKG.tar.gz -fi -cd $PEGASUS_PKG - -./run.sh start_onebox -m 2 -r 3 -w -cd ../ - -GO111MODULE=on make build -./bin/echo > /dev/null 2>&1 & # run echoserver in the background, drop its stderr/stdout - -if ! GO111MODULE=on time make ci -then - cd $PEGASUS_PKG - ./run.sh list_onebox - exit 1 -fi