chore(go-client-ci): build the server instead of downloading it from external site #124
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
--- | |
# workflow name | |
name: Golang Lint and Unit Test - go-client | |
# on events | |
on: | |
# run on each pull request | |
pull_request: | |
types: [ synchronize, reopened, opened ] | |
branches: | |
- master | |
- 'v[0-9]+.*' # release branch | |
- ci-test # testing branch for github action | |
- '*dev' | |
paths: | |
- .github/workflows/lint_and_test_go-client.yml | |
- go-client/** | |
# for manually triggering workflow | |
workflow_dispatch: | |
# workflow tasks | |
jobs: | |
lint: | |
name: Lint | |
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: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18 | |
- name: Build | |
run: make build | |
working-directory: ./go-client | |
# 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 | |
test: | |
name: Test | |
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: Free Disk Space (Ubuntu) | |
run: | | |
.github/workflows/free_disk_space.sh | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
thirdparty: | |
- '.github/workflows/thirdparty-regular-push.yml' | |
- 'docker/thirdparties-src/**' | |
- 'docker/thirdparties-bin/**' | |
- 'thirdparty/**' | |
- name: Unpack prebuilt third-parties | |
if: steps.changes.outputs.thirdparty == 'false' | |
run: | | |
rm -f /root/thirdparties-src.zip | |
unzip /root/thirdparties-bin.zip -d ./thirdparty | |
rm -f /root/thirdparties-bin.zip | |
find ./thirdparty -name '*CMakeFiles*' -type d -exec rm -rf "{}" + | |
rm -rf ./thirdparty/hadoop-bin/share/doc | |
rm -rf ./thirdparty/zookeeper-bin/docs | |
# TODO(yingchun): Build a docker image with prebuilt server binaries, we can use them directly without building server binaries if no server changes. | |
- name: Rebuild third-parties | |
if: steps.changes.outputs.thirdparty == 'true' | |
working-directory: thirdparty | |
# Build thirdparties and leave some necessary libraries and source | |
run: | | |
rm -f /root/thirdparties-src.zip | |
mkdir build | |
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=1 -B build/ | |
cmake --build build/ -j $(nproc) | |
rm -rf build/Build build/Download/[a-y]* build/Source/[a-g]* build/Source/[i-q]* build/Source/[s-z]* | |
find ./ -name '*CMakeFiles*' -type d -exec rm -rf "{}" + | |
../scripts/download_hadoop.sh hadoop-bin | |
../scripts/download_zk.sh zookeeper-bin | |
rm -rf hadoop-bin/share/doc | |
rm -rf zookeeper-bin/docs | |
- name: Build Pegasus server | |
run: | | |
./run.sh build --skip_thirdparty -j $(nproc) -t release | |
- name: Clear build temporary files | |
run: | | |
find ./build/latest/src/ -name '*CMakeFiles*' -type d -exec rm -rf "{}" + | |
- 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 | |
run: | | |
make build | |
make ci | |