chore: import upstream snapshot with attribution
Update draft releases / main (push) Has been cancelled
Build and push docs image / build-image (push) Has been cancelled
Build Web Application / build-web (macos-latest) (push) Has been cancelled
Build Web Application / build-web (ubuntu-latest) (push) Has been cancelled
Python Code Quality Checks / build (push) Has been cancelled
Test Python / test-python (macos-latest, 3.10) (push) Has been cancelled
Test Python / test-python (macos-latest, 3.11) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.10) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.11) (push) Has been cancelled
Update draft releases / main (push) Has been cancelled
Build and push docs image / build-image (push) Has been cancelled
Build Web Application / build-web (macos-latest) (push) Has been cancelled
Build Web Application / build-web (ubuntu-latest) (push) Has been cancelled
Python Code Quality Checks / build (push) Has been cancelled
Test Python / test-python (macos-latest, 3.10) (push) Has been cancelled
Test Python / test-python (macos-latest, 3.11) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.10) (push) Has been cancelled
Test Python / test-python (ubuntu-latest, 3.11) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
name: Build Web Application
|
||||
|
||||
# Triggered when the web directory or this file is changed
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- web/**
|
||||
- .github/workflows/build-web.yml
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- web/**
|
||||
- .github/workflows/build-web.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.event.number || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
defaults:
|
||||
run:
|
||||
# Runs all jobs in the web directory
|
||||
working-directory: ./web
|
||||
|
||||
jobs:
|
||||
build-web:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# FIXME: Add windows-latest support
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
yarn install
|
||||
|
||||
- name: Build web application
|
||||
run: |
|
||||
yarn build
|
||||
@@ -0,0 +1,22 @@
|
||||
name: Close inactive issues
|
||||
on:
|
||||
schedule:
|
||||
- cron: "00 21 * * *"
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
days-before-issue-stale: 120
|
||||
days-before-issue-close: 90
|
||||
stale-issue-label: "stale"
|
||||
stale-issue-message: "This issue has been marked as `stale`, because it has been over 30 days without any activity."
|
||||
close-issue-message: "This issue bas been closed, because it has been marked as `stale` and there has been no activity for over 7 days."
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Python Code Quality Checks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.event.number || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install uv
|
||||
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
- name: Install dependencies and setup environment
|
||||
run: |
|
||||
uv -V
|
||||
make setup
|
||||
- name: Check Python code style
|
||||
run: make fmt-check
|
||||
# TODO: Add mypy check
|
||||
# - name: Check Python code type
|
||||
# run: make mypy
|
||||
@@ -0,0 +1,73 @@
|
||||
name: Build and push docs image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/doc-image-publish.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'docs/**'
|
||||
- '.github/workflows/doc-image-publish.yml'
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to build (default: main)'
|
||||
required: true
|
||||
default: 'main'
|
||||
type: string
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
|
||||
|
||||
- name: Debug git status
|
||||
run: |
|
||||
echo "Current commit: $(git rev-parse HEAD)"
|
||||
echo "Current branch: $(git rev-parse --abbrev-ref HEAD || echo 'detached HEAD')"
|
||||
echo "Main branch commit: $(git rev-parse origin/main)"
|
||||
echo "Using branch: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref_name }}"
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
# Only login to Docker Hub when not in PR
|
||||
- name: Login to Docker Hub
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
# Only run when there is a PR
|
||||
- name: Build PR
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./docs/Dockerfile-deploy
|
||||
platforms: linux/amd64
|
||||
push: false
|
||||
|
||||
# Only run when it is not a PR, build and push the image
|
||||
- name: Build and push
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./docs/Dockerfile-deploy
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: eosphorosai/dbgpt-docs:${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref_name }},eosphorosai/dbgpt-docs:latest
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
name: Build and Push OpenAI Docker Image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
# run unless event type is pull_request
|
||||
if: github.event_name != 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: free disk space
|
||||
run: |
|
||||
sudo swapoff -a
|
||||
sudo rm -f /swapfile
|
||||
sudo apt clean
|
||||
# Only delete Docker images when they exist
|
||||
if [ ! -z "$(docker image ls -aq)" ]; then
|
||||
docker rmi $(docker image ls -aq)
|
||||
fi
|
||||
df -h
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/base/Dockerfile
|
||||
build-args: |
|
||||
BASE_IMAGE=ubuntu:22.04
|
||||
EXTRAS=base,proxy_openai,rag,graph_rag,storage_chromadb,dbgpts,proxy_ollama,proxy_zhipuai,proxy_anthropic,proxy_qianfan,proxy_tongyi
|
||||
PIP_INDEX_URL=https://pypi.org/simple
|
||||
platforms: linux/arm64,linux/amd64
|
||||
push: true
|
||||
tags: eosphorosai/dbgpt-openai:${{ github.ref_name }},eosphorosai/dbgpt-openai:latest
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
name: Push docker image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
# run unless event type is pull_request
|
||||
if: github.event_name != 'pull_request'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: free disk space
|
||||
run: |
|
||||
sudo swapoff -a
|
||||
sudo rm -f /swapfile
|
||||
sudo apt clean
|
||||
# Only delete Docker images when they exist
|
||||
if [ ! -z "$(docker image ls -aq)" ]; then
|
||||
docker rmi $(docker image ls -aq)
|
||||
fi
|
||||
df -h
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/base/Dockerfile
|
||||
build-args: |
|
||||
PIP_INDEX_URL=https://pypi.org/simple
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: eosphorosai/dbgpt:${{ github.ref_name }},eosphorosai/dbgpt:latest
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Pull request labeler
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Label pull request
|
||||
uses: release-drafter/release-drafter@v5
|
||||
with:
|
||||
disable-releaser: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,88 @@
|
||||
# This workflow will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
||||
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, data_privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
name: Upload Python Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Package version (e.g. 0.7.0rc0)'
|
||||
required: true
|
||||
type: string
|
||||
publish_to_testpypi:
|
||||
description: 'Publish to TestPyPI'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
publish_to_pypi:
|
||||
description: 'Publish to PyPI'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: python
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: ".python-version"
|
||||
|
||||
- name: Update version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
export DB_GPT_VERSION=${{ inputs.version }} make package
|
||||
echo "Updating version in all files to $DB_GPT_VERSION"
|
||||
cd scripts
|
||||
uv run update_version_all.py $DB_GPT_VERSION -y
|
||||
cd ..
|
||||
else
|
||||
echo "Prepping package for release"
|
||||
fi
|
||||
|
||||
- name: Install the project
|
||||
run: uv sync --all-packages --dev
|
||||
|
||||
- name: Build package using Make
|
||||
run: |
|
||||
make build
|
||||
ls dist/
|
||||
|
||||
- name: Upload wheel as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist-packages
|
||||
path: dist/*
|
||||
retention-days: 7
|
||||
|
||||
- name: Publish package to TestPyPI
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish_to_testpypi == true }}
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
|
||||
- name: Publish package distributions to PyPI
|
||||
if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish_to_pypi == true) }}
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
@@ -0,0 +1,22 @@
|
||||
name: Update draft releases
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Draft DB-GPT release
|
||||
uses: release-drafter/release-drafter@v5
|
||||
with:
|
||||
config-name: release-drafter.yml
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,99 @@
|
||||
name: Test Python
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- dbgpt/**
|
||||
- pilot/meta_data/**
|
||||
- .github/workflows/test-python.yml
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- dbgpt/**
|
||||
- pilot/meta_data/**
|
||||
- .github/workflows/test-python.yml
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.event.number || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
#permissions:
|
||||
# contents: read
|
||||
# pull-requests: write
|
||||
#
|
||||
jobs:
|
||||
test-python:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# TODO: Add windows-latest support
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
python-version: ["3.10", "3.11"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[openai]"
|
||||
pip install -r requirements/dev-requirements.txt
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
pytest dbgpt --cov=dbgpt --cov-report=xml:coverage-${{ matrix.python-version }}-${{ matrix.os }}.xml --cov-report=html:htmlcov-${{ matrix.python-version }}-${{ matrix.os }} --junitxml=pytest_report-${{ matrix.python-version }}-${{ matrix.os }}.xml
|
||||
|
||||
- name: Generate coverage report summary
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
id: cov-report
|
||||
run: |
|
||||
coverage_file="coverage-${{ matrix.python-version }}-${{ matrix.os }}.xml"
|
||||
# Pase the coverage file and get the line rate for each package(two level)
|
||||
coverage_summary=$(grep -oP '<package name="\K[^"]+' $coverage_file | awk -F"." '{ if (NF == 2) print $0 }' | while read -r package_name; do
|
||||
line_rate=$(grep -oP "<package name=\"$package_name\" line-rate=\"\K[^\"]+" $coverage_file)
|
||||
echo "$package_name line-rate: $line_rate"
|
||||
done)
|
||||
echo "Coverage Summary: $coverage_summary"
|
||||
echo "::set-output name=summary::$coverage_summary"
|
||||
|
||||
- name: Generate test report summary
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
id: test-report
|
||||
run: |
|
||||
test_file="pytest_report-${{ matrix.python-version }}-${{ matrix.os }}.xml"
|
||||
total_tests=$(grep -oP 'tests="\K\d+' $test_file)
|
||||
failures=$(grep -oP 'failures="\K\d+' $test_file)
|
||||
skipped=$(grep -oP 'skipped="\K\d+' $test_file)
|
||||
test_summary="Total tests: $total_tests, Failures: $failures, Skipped: $skipped"
|
||||
echo "Test Summary: $test_summary"
|
||||
echo "::set-output name=summary::$test_summary"
|
||||
|
||||
# TODO: Add comment on PR
|
||||
# - name: Comment on PR
|
||||
# if: github.event_name == 'pull_request_target' && matrix.os == 'ubuntu-latest'
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# run: |
|
||||
# PR_COMMENT="## Test Coverage and Report Summary\n${{ steps.cov-report.outputs.summary }}\n${{ steps.test-report.outputs.summary }}"
|
||||
# PR_COMMENTS_URL=$(jq -r .pull_request.comments_url < "$GITHUB_EVENT_PATH")
|
||||
# curl -s -S -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: application/json" -X POST --data "{ \"body\": \"$PR_COMMENT\" }" "$PR_COMMENTS_URL"
|
||||
#
|
||||
- name: Upload test and coverage results
|
||||
uses: actions/upload-artifact@v3
|
||||
if: always()
|
||||
with:
|
||||
name: test-and-coverage-results-${{ matrix.python-version }}-${{ matrix.os }}
|
||||
path: |
|
||||
pytest_report-${{ matrix.python-version }}-${{ matrix.os }}.xml
|
||||
coverage-${{ matrix.python-version }}-${{ matrix.os }}.xml
|
||||
htmlcov-${{ matrix.python-version }}-${{ matrix.os }}/*
|
||||
if-no-files-found: ignore
|
||||
Reference in New Issue
Block a user