Skip to content

Commit

Permalink
Reduce duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 committed Dec 20, 2023
1 parent dec19d4 commit 39fc55d
Show file tree
Hide file tree
Showing 17 changed files with 319 additions and 435 deletions.
52 changes: 52 additions & 0 deletions .github/actions/build_pegasus/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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: Build Pegasus
runs:
using: composite
steps:
- name: Setup cache
uses: actions/cache@v3
with:
path: |
/github/home/.ccache
key: ${{ env.ARTIFACT_NAME }}_ccache
- name: Free Disk Space (Ubuntu)
run: |
.github/workflows/free_disk_space.sh
shell: bash
- name: Compilation
run: |
ccache -p
ccache -z
./run.sh build -j $(nproc) --skip_thirdparty ${BUILD_OPTIONS}
ccache -s
shell: bash
- name: Pack Server
run: |
./run.sh pack_server -j
rm -rf pegasus-server-*
shell: bash
- name: Pack Tools
run: |
./run.sh pack_tools -j
rm -rf pegasus-tools-*
shell: bash
- name: Clear Build Files
run: |
find ./build/latest/src/ -name '*CMakeFiles*' -type d -exec rm -rf "{}" +
shell: bash
36 changes: 36 additions & 0 deletions .github/actions/download_artifact/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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: Download artifact
runs:
using: composite
steps:
- name: Unpack prebuilt third-parties
run: |
unzip /root/thirdparties-bin.zip -d ./thirdparty
rm -f /root/thirdparties-bin.zip
shell: bash
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}_artifact_${{ github.sha }}
path: .
- name: Tar files
run: |
tar -zxvf ${ARTIFACT_NAME}_builder.tar
rm -f ${ARTIFACT_NAME}_builder.tar
shell: bash
56 changes: 56 additions & 0 deletions .github/actions/rebuild_thirdparty_if_needed/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 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: Rebuild thirdparty if needed
runs:
using: composite
steps:
- 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
shell: bash
- name: Rebuild third-parties
if: steps.changes.outputs.thirdparty == 'true'
working-directory: thirdparty
# Build third-parties and leave some necessary libraries and source.
run: |
rm -f /root/thirdparties-src.zip
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=1 -DUSE_JEMALLOC=${USE_JEMALLOC} -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
shell: bash
27 changes: 27 additions & 0 deletions .github/actions/run_server_tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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: Run server tests
runs:
using: composite
steps:
- name: Unit Testing
run: |
export LD_LIBRARY_PATH=$(pwd)/thirdparty/output/lib:${JAVA_HOME}/jre/lib/amd64/server
ulimit -s unlimited
./run.sh test --onebox_opts "$ONEBOX_OPTS" --test_opts "$TEST_OPTS" -m ${{ matrix.test_module }}
shell: bash
38 changes: 38 additions & 0 deletions .github/actions/upload_artifact/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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: Upload artifact
runs:
using: composite
steps:
- name: Tar files
run: |
mv thirdparty/hadoop-bin ./
mv thirdparty/zookeeper-bin ./
rm -rf thirdparty
# The following operations are tricky, these directories and files don't exist if not build with '--test'.
# When build binaries for client tests, it's not needed to add '--test'.
mkdir -p build/latest/bin
mkdir -p build/latest/src/server/test
touch build/latest/src/server/test/config.ini
tar -zcvhf ${ARTIFACT_NAME}_builder.tar build/latest/output build/latest/bin build/latest/src/server/test/config.ini hadoop-bin zookeeper-bin
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}_artifact_${{ github.sha }}
path: ${{ env.ARTIFACT_NAME }}_builder.tar
1 change: 1 addition & 0 deletions .github/workflows/lint_and_test_admin-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
- ci-test # testing branch for github action
- '*dev'
paths:
- .github/workflows/lint_and_test_admin-cli.yml
- admin-cli/**

# for manually triggering workflow
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint_and_test_admin-cli_always_pass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
- ci-test # testing branch for github action
- '*dev'
paths-ignore:
- .github/workflows/lint_and_test_admin-cli_always_pass.yml
- admin-cli/**

# for manually triggering workflow
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint_and_test_collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ on:
- ci-test # testing branch for github action
- '*dev'
paths:
- '.github/workflows/lint_and_test_collector.yml'
- 'collector/**'
- .github/workflows/lint_and_test_collector.yml
- collector/**

# for manually triggering workflow
workflow_dispatch:
Expand Down
Loading

0 comments on commit 39fc55d

Please sign in to comment.