Lint and build regularly #399
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-latest | |
container: | |
image: apache/pegasus:clang-format-3.9 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: clang-format | |
run: ./scripts/run-clang-format.py --clang-format-executable clang-format-3.9 -e ./src/shell/linenoise -e ./src/shell/sds -e ./thirdparty -r . | |
build_cpp: | |
name: Build Cpp | |
runs-on: ubuntu-latest | |
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 | |
working-directory: /root | |
run: | | |
git clone -b ${{ github.ref_name }} --depth=1 https://github.com/apache/incubator-pegasus.git | |
- name: Free Disk Space (Ubuntu) | |
run: | | |
.github/workflows/free_disk_space.sh | |
- name: Unpack prebuilt third-parties | |
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 | |
- name: Compilation Pegasus | |
run: | | |
./run.sh build --test --compiler ${{ matrix.compiler }} --skip_thirdparty -j $(nproc) | |
- name: Clear Build Files | |
run: | | |
find ./build/latest/src/ -name '*CMakeFiles*' -type d -exec rm -rf "{}" + | |
- name: Packaging Server | |
run: | | |
./run.sh pack_server | |
rm -rf pegasus-server-* | |
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@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.14 | |
- name: Build go-client | |
run: make | |
working-directory: ./go-client | |
- name: Lint go-client | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.29 | |
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.29 | |
working-directory: ./admin-cli | |
- name: Build pegic | |
run: make | |
working-directory: ./pegic | |
- name: Lint pegic | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.29 | |
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@v3 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java }} | |
- name: Build | |
working-directory: ./java-client | |
run: | | |
cd scripts && bash recompile_thrift.sh && cd - | |
mvn spotless:apply | |
mvn clean package -DskipTests |