-
Notifications
You must be signed in to change notification settings - Fork 312
137 lines (130 loc) · 4.34 KB
/
lint_and_test_go-client.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# 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:
env:
ARTIFACT_NAME: release_for_go_client
# workflow tasks
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Format
working-directory: ./go-client
run: |
gofmt -d .
test -z "$(gofmt -d .)"
lint:
name: Lint
needs: format
# 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
run: sudo apt-get install -y thrift-compiler
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.18
- name: Build
working-directory: ./go-client
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.56.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@v4
- 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@v4
- 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: |
GO111MODULE=on make build
./bin/echo > /dev/null 2>&1 &
GO111MODULE=on make ci