Skip to content

Commit

Permalink
add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Janet731 committed Apr 8, 2024
1 parent 8d93d14 commit f4eb169
Show file tree
Hide file tree
Showing 62 changed files with 2,142 additions and 5 deletions.
171 changes: 171 additions & 0 deletions .github/actions/confWriter/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
name: "conf-writer"
description: "use conf-writer to change the target/conf after IGinX was installed"
inputs:
if-CapExp:
description: "if you need capacity expansion"
required: false
default: "false"
DB-name:
description: "DB name"
required: false
default: IoTDB12
Test-Way:
description: "the way to test"
required: false
default: clearData
Read-Only:
description: "make the storage engine read-only"
required: false
default: "false"
Push-Down:
description: "make the IGinX push down filter"
required: false
default: "false"

runs:
using: "composite" # Mandatory parameter
steps:
- if: inputs.DB-name=='FileSystem' || inputs.DB-name=='Parquet'
name: save config for FileSystem and Parquet
shell: bash
run: |
cp -f "${GITHUB_WORKSPACE}/conf/config.properties" "${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties"
- if: inputs.DB-name=='FileSystem' || inputs.DB-name=='Parquet'
name: save config for FileSystem and Parquet
shell: bash
run: |
cp -f "${GITHUB_WORKSPACE}/conf/config.properties" "${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties"
- name: Set if-CapExp
shell: bash
run: |
echo "${{ inputs.if-CapExp }}" > ${GITHUB_WORKSPACE}/test/src/test/resources/isScaling.txt
- if: inputs.if-CapExp=='true'
name: Change has_data
shell: bash
run: |
echo "${{ inputs.Test-Way }}" > ${GITHUB_WORKSPACE}/test/src/test/resources/dbce-test-way.txt
if [[ "${{ inputs.Test-Way }}" == "oriHasDataExpHasData" || "${{ inputs.Test-Way }}" == "oriHasDataExpNoData" ]]; then
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/has_data=false/has_data=true/g" ${GITHUB_WORKSPACE}/core/target/iginx-core-0.6.0-SNAPSHOT/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sed -i "" "s/has_data=false/has_data=true/" ${GITHUB_WORKSPACE}/core/target/iginx-core-0.6.0-SNAPSHOT/conf/config.properties
fi
elif [[ "${{ inputs.Test-Way }}" == "oriNoDataExpHasData" || "${{ inputs.Test-Way }}" == "oriNoDataExpNoData" ]]; then
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/has_data=true/has_data=false/g" ${GITHUB_WORKSPACE}/core/target/iginx-core-0.6.0-SNAPSHOT/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sed -i "" "s/has_data=true/has_data=false/" ${GITHUB_WORKSPACE}/core/target/iginx-core-0.6.0-SNAPSHOT/conf/config.properties
fi
fi
- name: Set DB-name
shell: bash
run: |
echo "${{ inputs.DB-name }}" > ${GITHUB_WORKSPACE}/test/src/test/resources/DBName.txt
- name: Change UDF conf
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/needInitBasicUDFFunctions=false/needInitBasicUDFFunctions=true/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/needInitBasicUDFFunctions=false/needInitBasicUDFFunctions=true/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/pythonCMD=python3/pythonCMD=python/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/needInitBasicUDFFunctions=false/needInitBasicUDFFunctions=true/' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
- if: inputs.Read-Only=='true'
name: Change is_read_only
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/is_read_only=false/is_read_only=true/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/is_read_only=false/is_read_only=true/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/is_read_only=false/is_read_only=true/' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
- if: inputs.Push-Down=='true'
name: Change push_down
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/enablePushDown=false/enablePushDown=true/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/queryOptimizer=rbo/queryOptimizer=rbo,filter_push_down/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/enablePushDown=false/enablePushDown=true/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i 's/queryOptimizer=rbo/queryOptimizer=rbo,filter_push_down/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/enablePushDown=false/enablePushDown=true/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
sed -i '' 's/queryOptimizer=rbo/queryOptimizer=rbo,filter_push_down/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
- if: inputs.Set-Key-Range-Test-Policy=='true'
name: Change KeyRangeTestPolicy
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/policyClassName=cn.edu.tsinghua.iginx.policy.naive.NaivePolicy/policyClassName=cn.edu.tsinghua.iginx.policy.test.KeyRangeTestPolicy/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
- if: inputs.Set-Filter-Fragment-OFF=='true'
name: Set FragmentPruningByFilterRule OFF
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/ruleBasedOptimizer=NotFilterRemoveRule=on,FragmentPruningByFilterRule=on/ruleBasedOptimizer=NotFilterRemoveRule=on/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/ruleBasedOptimizer=NotFilterRemoveRule=on,FragmentPruningByFilterRule=on/ruleBasedOptimizer=NotFilterRemoveRule=on/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/ruleBasedOptimizer=NotFilterRemoveRule=on,FragmentPruningByFilterRule=on/ruleBasedOptimizer=NotFilterRemoveRule=on/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/config.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
- name: Change Log conf
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/^rootLogger[.]level=.*$/rootLogger.level=debug/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/log4j2.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/^rootLogger[.]level=.*$/rootLogger.level=debug/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/log4j2.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/^rootLogger[.]level=.*$/rootLogger.level=debug/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/log4j2.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
- name: Change File Permission
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo sed -i 's/^default.transformerRule.include=.*$/default.transformerRule.include=glob:**.denied/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/file-permission.properties
sudo sed -i 's/^default.transformerRule.write=.*$/default.transformerRule.write=false/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/file-permission.properties
elif [ "$RUNNER_OS" == "Windows" ]; then
sed -i 's/^default.transformerRule.include=.*$/default.transformerRule.include=glob:**.denied/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/file-permission.properties
sed -i 's/^default.transformerRule.write=.*$/default.transformerRule.write=false/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/file-permission.properties
elif [ "$RUNNER_OS" == "macOS" ]; then
sudo sed -i '' 's/^default.transformerRule.include=.*$/default.transformerRule.include=glob:**.denied/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/file-permission.properties
sudo sed -i '' 's/^default.transformerRule.write=.*$/default.transformerRule.write=false/g' ${GITHUB_WORKSPACE}/core/target/iginx-core-${VERSION}/conf/file-permission.properties
else
echo "$RUNNER_OS is not supported"
exit 1
fi
71 changes: 71 additions & 0 deletions .github/actions/context/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "set context"
description: "set context"
inputs:
work-name:
description: "current work name"
required: false
default: client
shell:
description: "start shell"
required: false
default: client
DB-name:
description: "DB name"
required: false
default: IoTDB12

runs:
using: "composite" # Mandatory parameter
steps:
- if: inputs.work-name=='stop-iginx-zk' || inputs.work-name=='restart-iginx-zk'
name: Stop IGinX
uses: ./.github/actions/iginxRunner
with:
version: ${VERSION}
if-stop: true

- if: inputs.work-name=='stop-iginx-zk' || inputs.work-name=='restart-iginx-zk'
name: Stop and clear ZooKeeper
uses: ./.github/actions/zookeeperRunner
with:
if-stop: true

- if: inputs.work-name=='start-iginx-zk' || inputs.work-name=='restart-iginx-zk'
name: Run ZooKeeper
uses: ./.github/actions/zookeeperRunner
with:
if-rerun: true

- if: inputs.work-name=='start-iginx-zk' || inputs.work-name=='restart-iginx-zk'
name: Start IGinX
uses: ./.github/actions/iginxRunner

- if: inputs.shell=='client-before'
name: Pre Test Client Export File
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_outfile.sh"
"${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_outfile.sh" "${{ inputs.DB-name }}"
elif [ "$RUNNER_OS" == "Windows" ]; then
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_outfile_windows.sh"
"${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_outfile_windows.sh" "${{ inputs.DB-name }}"
elif [ "$RUNNER_OS" == "macOS" ]; then
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_outfile_macos.sh"
"${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_outfile_macos.sh" "${{ inputs.DB-name }}"
fi
- if: inputs.shell=='client-after'
name: Pre Test Client Import File
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_infile.sh"
"${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_infile.sh"
elif [ "$RUNNER_OS" == "Windows" ]; then
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_infile_windows.sh"
"${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_infile_windows.sh"
elif [ "$RUNNER_OS" == "macOS" ]; then
chmod +x "${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_infile_macos.sh"
"${GITHUB_WORKSPACE}/.github/scripts/test/cli/test_infile_macos.sh"
fi
23 changes: 23 additions & 0 deletions .github/actions/dbLog/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "show DB log"
description: "show DB log"
inputs:
DB-name:
description: "DB name"
required: true
default: IoTDB12

runs:
using: "composite"
steps:
- if: ${{ inputs.DB-name=='Mix-IoTDB12-InfluxDB' && runner.os == 'Windows' }}
name: Show DB Log
shell: bash
run: |
"${GITHUB_WORKSPACE}/.github/actions/dbLog/dbLog.sh" IoTDB12
"${GITHUB_WORKSPACE}/.github/actions/dbLog/dbLog.sh" InfluxDB
- if: ${{ inputs.DB-name!='Mix-IoTDB12-InfluxDB' && runner.os == 'Windows' }}
name: Show DB Log
shell: bash
run: |
"${GITHUB_WORKSPACE}/.github/actions/dbLog/dbLog.sh" ${{ inputs.DB-name }}
49 changes: 49 additions & 0 deletions .github/actions/dbLog/dbLog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

# Only works on WindowsOS
# all logs are stored in {DB_DIR_ROOT}/logs/db.log & {DB_DIR_ROOT}/logs/db-error.log(optional)
dbName=$1

case $dbName in
IoTDB12)
dirName=apache-iotdb-0.12.6-server-bin-*
;;
InfluxDB)
dirName=influxdb2-2.7.4-window*
;;
MongoDB)
dirName=mongodb-win32-x86_64-windows-6.0.12-*
;;
Redis)
dirName=Redis-7.0.14-Windows-x64-*
;;
PostgreSQL)
dirName=pgsql-*
;;
*)
echo "DB:$dbName log not supported."
exit 0
;;
esac

for dir in $dirName; do
if [ -d "$dir" ]; then
echo "Entering: $dir"

# show db.log & db-error.log
if [ -f "$dir/logs/db.log" ]; then
echo "cat $dir/logs/db.log :"
cat "$dir/logs/db.log"
else
echo "$dir/logs/db.log not found."
fi

if [ -f "$dir/logs/db-error.log" ]; then
echo "cat $dir/logs/db-error.log :"
cat "$dir/logs/db-error.log"
else
echo "$dir/logs/db-error.log not found."
fi
fi
done

Loading

0 comments on commit f4eb169

Please sign in to comment.