diff --git a/.github/workflows/tdgpt-ci.yml b/.github/workflows/tdgpt-ci.yml new file mode 100644 index 0000000000..4a438938dc --- /dev/null +++ b/.github/workflows/tdgpt-ci.yml @@ -0,0 +1,51 @@ +name: TDgpt CI + +on: + pull_request: + branches: + - '3.0' + paths: + - 'tools/tdgpt/**' + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: ["3.10"] + + defaults: + run: + working-directory: ${{ github.workspace }}/tools/tdgpt + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest pylint + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Checking the code with pylint + run: | + pylint $(git ls-files '*.py') --exit-zero + + - name: Checking the code with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + + - name: Run test cases with pytest + run: | + pytest diff --git a/.github/workflows/tdgpt-update-service.yml b/.github/workflows/tdgpt-update-service.yml new file mode 100644 index 0000000000..fa7344ce74 --- /dev/null +++ b/.github/workflows/tdgpt-update-service.yml @@ -0,0 +1,41 @@ +name: TDgpt Update Service + +on: + schedule: + - cron: '30 00 * * *' + +env: + WKC: "/root/TDengine" + +jobs: + update-service: + runs-on: + group: CI + labels: [self-hosted, Linux, X64, tdgpt-anode-service] + steps: + - name: Update TDengine codes + run: | + set -euo pipefail + cd ${{ env.WKC }} + git checkout 3.0 + + - name: Package the TDGpt Anode Service + run: | + set -euo pipefail + cd ${{ env.WKC }}/tools/tdgpt/script && ./release.sh + + - name: Reinstall and restart the TDGpt Anode Service + run: | + set -euo pipefail + cd ${{ env.WKC }}/tools/tdgpt/release + if [[ -f "TDengine-enterprise-anode-1.0.1.tar.gz" ]]; then + tar -xzf TDengine-enterprise-anode-1.0.1.tar.gz + cd TDengine-enterprise-anode-1.0.1 + ./install.sh + fi + systemctl restart taosanoded + + - name: Clean up + if: always() + run: | + if [[ -f ${{ env.WKC }}/tools/tdgpt/release/TDengine-enterprise-anode-1.0.1 ]] then rm -rf ${{ env.WKC }}/tools/tdgpt/release/TDengine-enterprise-anode-1.0.1; fi