iotdb 启停测试 #610
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
# 用于在多种不同操作系统,多种jdk环境下,进行iotdb的启停测试 | |
name: iotdb 启停测试 | |
on: | |
schedule: | |
- cron: "0 12 * * *" | |
workflow_dispatch: | |
jobs: | |
#-------- | |
check-commit: | |
outputs: | |
commit_id: ${{steps.check-cur-status.outputs.commit_id}} | |
commit_id_short: ${{ steps.check-cur-status.outputs.commit_id_short }} | |
version: ${{ steps.check-cur-status.outputs.version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 20 | |
matrix: | |
os: [ ubuntu-latest ] | |
steps: | |
# get iotdb | |
- name: Checkout apache/iotdb | |
uses: actions/checkout@v2 | |
with: | |
path: iotdb | |
repository: 'apache/iotdb' | |
ref: 'rel/1.0' | |
fetch-depth: 0 | |
# get cur-repository | |
- name: Checkout iotdb-daily-build | |
uses: actions/checkout@v2 | |
with: | |
path: iotdb-daily-build | |
repository: 'xiaoyekanren/iotdb-daily-build' | |
ref: 'master' | |
fetch-depth: 0 | |
# check cur status | |
- name: check | |
id: check-cur-status | |
run: | | |
cd ${{ github.workspace }}/iotdb | |
echo "commit_id=$( git rev-parse HEAD )" >> $GITHUB_OUTPUT | |
echo "commit_id_short=$( git rev-parse --short HEAD )" >> $GITHUB_OUTPUT | |
echo "commit_time=$(git log -n1 --pretty='format:%cd' --date=iso)" >> $GITHUB_OUTPUT | |
echo "commit_user=$(git log | head -n 2 | tail -n 1 | cut -d ' ' -f 2)" >> $GITHUB_OUTPUT | |
echo "version=$(cat pom.xml | grep -e '^ <version>' | sed 's# ##g' | sed 's#<version>##g' | sed 's#</version>##g')" >> $GITHUB_OUTPUT | |
echo $(git rev-parse HEAD) | |
# check update | |
- name: check | |
id: check-old-commit | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build | |
echo "last_commit=$(cat .github/release_history.txt | tail -n 1)" >> $GITHUB_OUTPUT | |
echo $(cat .github/release_history.txt | tail -n 1) | |
# compare | |
- name: check check's results | |
run: | | |
echo "txt pid: ${{ steps.check-old-commit.outputs.last_commit }}" | |
echo "res pid: ${{ steps.check-cur-status.outputs.commit_id }}" | |
# equal means no update | |
# "exit 0" is exits normally,"exit other" is exception exit | |
- name: check check's results | |
if: ${{ steps.check-cur-status.outputs.commit_id == steps.check-old-commit.outputs.last_commit || steps.check-cur-status.outputs.commit_user == 'github-actions[bot]' }} | |
run: | | |
exit 0 | |
exit 1 | |
check-in-windows: | |
needs: check-commit | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 20 | |
matrix: | |
# java_version: [ 8 ] | |
java_version: [ 8, 11, 13, 15, 17, 18, 19 ] | |
os: [ windows-latest ] | |
steps: | |
# set java | |
- name: Set java ${{ matrix.java_version }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java_version }} | |
distribution: 'zulu' | |
# clone i-d-b | |
- name: checkout iotdb-daily-build | |
uses: actions/checkout@v2 | |
with: | |
path: iotdb-daily-build | |
repository: 'xiaoyekanren/iotdb-daily-build' | |
ref: master | |
fetch-depth: 0 | |
# collect i-d-b information | |
- name: iotdb-daily-build info | |
id: info-idb | |
shell: pwsh | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build | |
echo "idb_home=$(pwd)" >> $env:GITHUB_OUTPUT | |
# get iotdb | |
- name: Checkout apache/iotdb | |
uses: actions/checkout@v2 | |
with: | |
path: iotdb-src | |
repository: 'apache/iotdb' | |
ref: 'rel/1.0' | |
fetch-depth: 0 | |
# build iotdb | |
- name: build iotdb | |
id: build-iotdb | |
shell: pwsh | |
run: | | |
cd ${{ github.workspace }}/iotdb-src | |
mvn clean package -DskipTests -am -pl distribution | |
mv ${{ github.workspace }}/iotdb-src/distribution/target/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin ${{ github.workspace }}/iotdb-bin | |
cd ${{ github.workspace }}/iotdb-bin | |
echo "iotdb_home=$(pwd)" >> $env:GITHUB_OUTPUT | |
# C:\msys64\usr\bin\wget.exe -O${{ github.workspace }}/apache-iotdb-1.0.1-SNAPSHOT-all-bin-master-e68f560463.zip https://github.com/xiaoyekanren/iotdb-daily-build/releases/download/2022-12-12-java8-apache-iotdb/apache-iotdb-1.0.1-SNAPSHOT-all-bin-master-e68f560463.zip | |
# 7z x apache-iotdb-1.0.1-SNAPSHOT-all-bin-master-e68f560463.zip | |
# cd apache-iotdb-1.0.1-SNAPSHOT-all-bin | |
# echo "::set-output name=iotdb_home::$(pwd)" | |
- name: check para. | |
if: ${{ matrix.os == 'windows-latest' }} | |
shell: pwsh | |
run: | | |
echo "iotdb_home: ${{ steps.build-iotdb.outputs.iotdb_home }}" | |
echo "idb_home: ${{ steps.info-idb.outputs.idb_home }}" | |
echo "copy start-scripts to <iotdb>/sbin..." | |
cp ${{ steps.info-idb.outputs.idb_home }}/action-workflow-check-start_stop/check_scripts/step_1_start_confignode.vbs ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin/step_1_start_confignode.vbs | |
cp ${{ steps.info-idb.outputs.idb_home }}/action-workflow-check-start_stop/check_scripts/step_3_start_datanode.vbs ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin/step_3_start_datanode.vbs | |
# start test... | |
- name: start confignode. | |
shell: cmd | |
run: | | |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin | |
step_1_start_confignode.vbs | |
- name: sleep 10. | |
shell: pwsh | |
run: | | |
sleep 10 | |
- name: check start confignode. | |
shell: cmd | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts | |
step_2_check_start_confignode.bat ${{ steps.build-iotdb.outputs.iotdb_home }} | |
- name: start datanode. | |
shell: cmd | |
run: | | |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin | |
step_3_start_datanode.vbs | |
- name: sleep 10. | |
shell: pwsh | |
run: | | |
sleep 10 | |
- name: check start datanode | |
shell: cmd | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts | |
step_4_check_start_datanode.bat ${{ steps.build-iotdb.outputs.iotdb_home }} | |
- name: echo pid. | |
shell: cmd | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts | |
step_0_get_path.bat ${{ steps.build-iotdb.outputs.iotdb_home }} | |
- name: stop datanode. | |
shell: cmd | |
run: | | |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin | |
echo "stop datanode." | |
stop-datanode.bat | |
- name: sleep 3. | |
shell: pwsh | |
run: | | |
sleep 3 | |
- name: check stop datanode. | |
shell: cmd | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts | |
step_5_check_stop_datanode.bat ${{ steps.build-iotdb.outputs.iotdb_home }} | |
- name: stop confignode. | |
shell: cmd | |
run: | | |
cd ${{ steps.build-iotdb.outputs.iotdb_home }}/sbin | |
echo "stop confignode." | |
stop-confignode.bat | |
- name: sleep 3. | |
shell: pwsh | |
run: | | |
sleep 3 | |
- name: check stop confignode. | |
shell: cmd | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build/action-workflow-check-start_stop/check_scripts | |
step_6_check_stop_confignode.bat ${{ steps.build-iotdb.outputs.iotdb_home }} | |
check-in-linux: | |
needs: check-commit | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
max-parallel: 20 | |
matrix: | |
java_version: [ 8, 11, 13, 15, 17, 18, 19 ] | |
os: [ ubuntu-latest ] | |
steps: | |
# set java | |
- name: Set java ${{ matrix.java_version }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java_version }} | |
distribution: 'zulu' | |
# get iotdb | |
- name: Checkout apache/iotdb | |
uses: actions/checkout@v2 | |
with: | |
path: iotdb | |
repository: 'apache/iotdb' | |
ref: 'rel/1.0' | |
fetch-depth: 0 | |
# build iotdb | |
- name: build iotdb | |
id: build-iotdb | |
run: | | |
cd ${{ github.workspace }}/iotdb | |
mvn clean package -DskipTests -am -pl distribution | |
mv ${{ github.workspace }}/iotdb/distribution/target/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin/apache-iotdb-${{ needs.check-commit.outputs.version }}-all-bin ${{ github.workspace }}/iotdb-binary | |
# test | |
- name: test start on ${{matrix.os}} | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
cd ${{ github.workspace }}/iotdb-binary | |
nohup sbin/start-confignode.sh > /dev/null 2>&1 & | |
cf_pid=$! | |
echo "confignode pid is ${cf_pid}" | |
sleep 10 | |
nohup sbin/start-datanode.sh > /dev/null 2>&1 & | |
df_pid=$! | |
echo "datanode pid is ${df_pid}" | |
sleep 5 | |
ps_cf_pid=$(ps -aux | grep $cf_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}') | |
ps_df_pid=$(ps -aux | grep $df_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}') | |
if [ "${ps_df_pid}1" == "1" ]; then | |
echo "Check start-datanode failed. exit.." | |
echo ------${ps_df_pid}1------ | |
exit 1 | |
else | |
echo "Check start-datanode Success. " | |
fi | |
if [ "${ps_cf_pid}1" == "1" ]; then | |
echo "Check start-confignode failed. exit.." | |
echo ------${ps_cf_pid}1------ | |
exit 1 | |
else | |
echo "Check start-confignode Success. " | |
fi | |
sbin/stop-datanode.sh | |
sleep 5 | |
ps -aux | grep $df_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}' | |
ps_df_pid=$(ps -aux | grep $df_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}') | |
if [ "${ps_df_pid}1" == "1" ]; then | |
echo "Check stop-datanode Success. " | |
else | |
echo "Check stop-datanode failed. exit.." | |
ps -aux | grep $df_pid | |
echo ------${ps_df_pid}1------ | |
exit 1 | |
fi | |
sbin/stop-confignode.sh | |
sleep 5 | |
ps -aux | grep $cf_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}' | |
ps_cf_pid=$(ps -aux | grep $cf_pid | grep -v 'grep --color=auto' | grep -v '[g]rep' | awk '{print $2}') | |
if [ "${ps_cf_pid}1" == "1" ]; then | |
echo "Check stop-confignode Success. " | |
else | |
echo "Check stop-confignode failed. exit.." | |
ps -aux | grep $cf_pid | |
echo ------${ps_cf_pid}1------ | |
exit 1 | |
fi | |
push-commit-id: | |
needs: [ check-commit,check-in-linux,check-in-windows ] | |
runs-on: ubuntu-latest | |
steps: | |
# get time | |
- name: collect common info | |
shell: bash | |
id: sys-info | |
run: | | |
echo "date=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT | |
# get cur-repository | |
- name: Checkout iotdb-daily-build | |
uses: actions/checkout@v2 | |
with: | |
path: iotdb-daily-build | |
repository: 'xiaoyekanren/iotdb-daily-build' | |
ref: 'master' | |
fetch-depth: 0 | |
# push commit id to repository | |
- name: push commit | |
env: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd ${{ github.workspace }}/iotdb-daily-build | |
git config --local user.email "876670773+github-actions[bot]@qq.com" | |
git config --local user.name "github-actions[bot]" | |
echo ${{ needs.check-commit.outputs.commit_id }} >> .github/release_history.txt | |
git add .github/release_history.txt | |
git commit -m "${{ steps.sys-info.outputs.date }}-${{ needs.check-commit.outputs.commit_id_short }}" | |
git push -u origin master |