Lint and build regularly #831
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. | |
--- | |
name: Lint and build regularly | |
on: | |
push: | |
paths: | |
- '.github/workflows/regular-build.yml' | |
branches: | |
- master | |
- 'v[0-9]+.*' # release branch | |
- ci-test # testing branch for github action | |
- '*dev' # developing branch | |
# for manually triggering workflow | |
workflow_dispatch: | |
# run for every day 2am UTC+8(Beijing) | |
schedule: | |
- cron: '0 18 */1 * *' | |
jobs: | |
lint_cpp: | |
name: Lint Cpp | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: clang-format | |
run: ./build_tools/run-clang-format.py --clang-format-executable clang-format-14 -e ./src/shell/linenoise -e ./src/shell/sds -e ./thirdparty -r . | |
build_cpp: | |
name: Build Cpp | |
runs-on: ubuntu-latest | |
env: | |
# The glibc version on ubuntu1804 and centos7 is lower than the node20 required, so | |
# we need to force the node version to 16. | |
# See more details: https://github.com/actions/checkout/issues/1809 | |
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu1804 | |
- ubuntu2004 | |
- ubuntu2204 | |
- centos7 | |
compiler: | |
- "gcc,g++" | |
include: | |
- compiler: "clang-14,clang++-14" | |
os: ubuntu2204 | |
- compiler: "clang-10,clang++-10" | |
os: ubuntu2004 | |
- compiler: "clang-9,clang++-9" | |
os: ubuntu1804 | |
container: | |
image: apache/pegasus:thirdparties-bin-${{ matrix.os }}-${{ github.ref_name }} | |
defaults: | |
run: | |
working-directory: /root/incubator-pegasus | |
steps: | |
- name: Clone Apache Pegasus Source | |
# The glibc version on ubuntu1804 and centos7 is lower than the actions/checkout@v4 required, so | |
# we need to force to use actions/checkout@v3. | |
uses: actions/checkout@v3 | |
- name: Unpack prebuilt third-parties | |
uses: "./.github/actions/unpack_prebuilt_thirdparties" | |
- name: Build Pegasus | |
uses: "./.github/actions/build_pegasus" | |
build_and_lint_go: | |
name: Build and Lint Golang | |
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@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18 | |
- name: Build go-client | |
run: make | |
working-directory: ./go-client | |
- name: Lint go-client | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55.2 | |
working-directory: ./go-client | |
- name: Build admin-cli | |
run: make | |
working-directory: ./admin-cli | |
- name: Lint admin-cli | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55.2 | |
working-directory: ./admin-cli | |
- name: Build pegic | |
run: make | |
working-directory: ./pegic | |
- name: Lint pegic | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55.2 | |
working-directory: ./pegic | |
build_java: | |
name: Build Java | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ '8', '11'] | |
steps: | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Download thrift | |
working-directory: ./java-client/scripts | |
run: ./download_thrift.sh | |
- name: Build | |
working-directory: ./java-client | |
run: | | |
mvn spotless:apply | |
mvn clean package -DskipTests |