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

This commit is contained in:
wehub-resource-sync
2026-07-13 13:27:08 +08:00
commit d13100ebf3
4413 changed files with 764874 additions and 0 deletions
+187
View File
@@ -0,0 +1,187 @@
name: Bug report
title: "[Bug] [Module Name] Bug title "
description: Create a report to help us improve
labels: [ "bug", "Waiting for reply" ]
body:
- type: markdown
attributes:
value: >
Thank you for taking the time to report a bug. The `[Module Name]` in title see
[here](https://github.com/eosphoros-ai/DB-GPT/labels?q=Module),
if you don't know the module name, you don't have to fill it in.
- type: checkboxes
attributes:
label: Search before asking
description: >
Please make sure to search in the [issues](https://github.com/eosphoros-ai/DB-GPT/issues?q=is%3Aissue)
first to see whether the same issue was reported already.
options:
- label: >
I had searched in the [issues](https://github.com/eosphoros-ai/DB-GPT/issues?q=is%3Aissue) and found
no similar issues.
required: true
- type: dropdown
id: system-information
attributes:
label: Operating system information
description: Operating system you use
options:
- Linux
- Windows
- MacOS(x86)
- MacOS(M1, M2...)
- Other
validations:
required: true
- type: dropdown
id: python-version
attributes:
label: Python version information
description: Python version you use
options:
- ">=3.11"
- "3.10"
- "3.9"
- "<3.9"
validations:
required: true
- type: dropdown
id: code-version
attributes:
label: DB-GPT version
description: >
Which version of DB-GPT are you running?
options:
- main
- latest release
- v0.3.7
- <v0.3.7
validations:
required: true
- type: checkboxes
id: related-scenes
attributes:
label: Related scenes
description: Select the scenes related to the issue (if applicable)
options:
- label: Chat Data
- label: Chat Excel
- label: Chat DB
- label: Chat Knowledge
- label: Model Management
- label: Dashboard
- label: Plugins
- type: checkboxes
id: installation-information
attributes:
label: Installation Information
description: Select your installation method
options:
- label: >
[Installation From Source](https://db-gpt.readthedocs.io/en/latest/getting_started/install/deploy/deploy.html)
- label: >
[Docker Installation](https://db-gpt.readthedocs.io/en/latest/getting_started/install/docker/docker.html)
- label: >
[Docker Compose Installation](https://db-gpt.readthedocs.io/en/latest/getting_started/install/docker/docker.html)
- label: >
[Cluster Installation](https://db-gpt.readthedocs.io/en/latest/getting_started/install/llm/cluster/model_cluster.html)
- label: AutoDL Image
- label: Other
- type: textarea
id: device-information
attributes:
label: Device information
description: Describe the device you use
placeholder: >
Device: CPU or GPU
If using GPU:
- GPU Count: 1
- GPU Memory: 24G
validations:
required: true
- type: textarea
id: models-information
attributes:
label: Models information
description: Describe the LLM and embedding model you use
placeholder: >
LLM: vicuna-13b-v1.5
Embedding model: text2vec-large-chinese
validations:
required: true
- type: textarea
attributes:
label: What happened
description: Describe the bug
placeholder: >
A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: What you expected to happen
description: What do you think went wrong?
placeholder: >
Thank you for your feedback! To better understand the issue:
1. Please describe why you believe the behavior is incorrect.
2. Share the relevant log segments or error messages. For UI issues, screenshots are appreciated.
3. For textual data, kindly copy and paste rather than using screenshots to facilitate easier searches in the future.
validations:
required: true
- type: textarea
attributes:
label: How to reproduce
description: >
What should we do to reproduce the problem? If you are not able to provide a reproducible case,
please open a [Discussion](https://github.com/orgs/eosphoros-ai/discussions) instead.
placeholder: >
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Any other context about the problem here?
placeholder: >
Add any other context about the problem here.
- type: checkboxes
attributes:
label: Are you willing to submit PR?
description: >
It's completely optional, but if you're interested in contributing, we're here to help!
If you have insights on the solution, that's even better. DB-GPT thrives on community support,
and we warmly welcome new contributors.
options:
- label: Yes I am willing to submit a PR!
- type: markdown
attributes:
value: "Thanks for completing our form!"
@@ -0,0 +1,47 @@
name: Documentation Related
description: Suggest an improvement or report a bug for this project's Documentation
title: "[Doc][Module Name] Documentation bug or improvement"
labels: [ "documentation", "Waiting for reply" ]
body:
- type: markdown
attributes:
value: >
Thank you for taking the time to suggest an improvement or report a bug for this project's documentation.
The `[Module Name]` in title see [here](https://github.com/eosphoros-ai/DB-GPT/labels?q=Module),
if you don't know the module name, you don't have to fill it in.
- type: checkboxes
attributes:
label: Search before asking
description: >
Please make sure to search in the [issues](https://github.com/eosphoros-ai/DB-GPT/issues?q=is%3Aissue) first
to see whether the same feature was requested already.
options:
- label: >
I had searched in the [issues](https://github.com/eosphoros-ai/DB-GPT/issues?q=is%3Aissue) and found no
similar feature requirement.
required: true
- type: textarea
attributes:
label: Description
description: A short description why your find in our document.
- type: textarea
attributes:
label: Documentation Links
description: Copy and paste one or more links of this documentation issue.
- type: checkboxes
attributes:
label: Are you willing to submit PR?
description: >
It's completely optional, but if you're interested in contributing, we're here to help!
If you have insights on the solution, that's even better. DB-GPT thrives on community support,
and we warmly welcome new contributors.
options:
- label: Yes I am willing to submit a PR!
- type: markdown
attributes:
value: "Thanks for completing our form!"
@@ -0,0 +1,64 @@
name: Feature request
description: Suggest an idea for this project
title: "[Feature][Module Name] Feature title"
labels: [ "enhancement", "Waiting for reply" ]
body:
- type: markdown
attributes:
value: >
Thank you for taking the time to suggest an idea for this project.
The `[Module Name]` in title see [here](https://github.com/eosphoros-ai/DB-GPT/labels?q=Module),
if you don't know the module name, you don't have to fill it in.
- type: checkboxes
attributes:
label: Search before asking
description: >
Please make sure to search in the [issues](https://github.com/eosphoros-ai/DB-GPT/issues?q=is%3Aissue) first
to see whether the same feature was requested already.
options:
- label: >
I had searched in the [issues](https://github.com/eosphoros-ai/DB-GPT/issues?q=is%3Aissue) and found no
similar feature requirement.
required: true
- type: textarea
attributes:
label: Description
description: A short description of your feature
- type: textarea
attributes:
label: Use case
description: What do you want to happen?
placeholder: >
Instead of detailing how to implement the feature, please describe your end goal or what you aim to achieve.
- type: textarea
attributes:
label: Related issues
description: Is there currently another issue associated with this?
- type: dropdown
id: priority
attributes:
label: Feature Priority
description: How would you rank the importance of this feature?
options:
- High
- Medium
- Low
- type: checkboxes
attributes:
label: Are you willing to submit PR?
description: >
It's completely optional, but if you're interested in contributing, we're here to help!
If you have insights on the solution, that's even better. DB-GPT thrives on community support,
and we warmly welcome new contributors.
options:
- label: Yes I am willing to submit a PR!
- type: markdown
attributes:
value: "Thanks for completing our form!"
@@ -0,0 +1,20 @@
# Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
# How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
# Snapshots:
Include snapshots for easier review.
# Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have already rebased the commits and make the commit message conform to the project standard.
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] Any dependent changes have been merged and published in downstream modules
+20
View File
@@ -0,0 +1,20 @@
# Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
# How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
# Snapshots:
Include snapshots for easier review.
# Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have already rebased the commits and make the commit message conform to the project standard.
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] Any dependent changes have been merged and published in downstream modules
+116
View File
@@ -0,0 +1,116 @@
categories:
- title: 🏆 Highlights
labels: highlight
- title: 🚀 Performance improvements
labels: performance
- title: ✨ Enhancements
labels: enhancement
- title: 🐞 Bug fixes
labels: fix
# - title: ⚠️ Deprecations
# labels: deprecation
- title: 🛠️ Other improvements
labels:
- documentation
- build
- internal
change-template: '- $TITLE (#$NUMBER)'
change-title-escapes: '\<*_&'
replacers:
# Remove conventional commits from titles
- search: '/- (build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)(\(.*\))?(\!)?\:\s?/g'
replace: '- '
autolabeler:
- label: model
title:
# feat(mode): Support llama-2
# fix(mode): Fix llama-2 xxx bug
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*model.*\)/'
- label: ChatData
title:
# feat(ChatData): Support xxxx
# fix(ChatData): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*ChatData.*\)/'
- label: ChatExcel
title:
# feat(ChatExcel): Support xxxx
# fix(ChatExcel): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*ChatExcel.*\)/'
- label: ChatDB
title:
# feat(ChatDB): Support xxxx
# fix(ChatDB): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*ChatDB.*\)/'
- label: ChatKnowledge
title:
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*ChatKnowledge.*\)/'
- label: ChatDashboard
title:
# feat(ChatDashboard): Support xxxx
# fix(ChatDashboard): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*ChatDashboard.*\)/'
- label: plugin
title:
# feat(plugin): Support xxxx
# fix(plugin): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*plugin.*\)/'
- label: agent
title:
# feat(agent): Support xxxx
# fix(agent): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*agent.*\)/'
- label: cli
title:
# feat(cli): Support xxxx
# fix(cli): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*cli.*\)/'
- label: prompt
title:
# feat(prompt): Support xxxx
# fix(prompt): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*prompt.*\)/'
- label: connection
title:
# feat(connection): Support xxxx
# fix(connection): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*connection.*\)/'
- label: core
title:
# feat(core): Support xxxx
# fix(core): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*core.*\)/'
- label: web
title:
# feat(web): Support xxxx
# fix(web): Fix xxx
- '/^(build|chore|ci|depr|docs|feat|fix|perf|refactor|release|test)\(.*web.*\)/'
- label: build
title:
- '/^build/'
- label: documentation
title:
- '/^docs/'
- label: enhancement
title:
- '/^feat/'
- label: fix
title:
- '/^fix/'
- label: performance
title:
- '/^perf/'
- label: release
title:
- '/^release/'
- label: internal
title:
- '/^(chore|ci|refactor|test)/'
template: |
$CHANGES
Thank you to all our contributors for making this release possible!
$CONTRIBUTORS
+50
View File
@@ -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
+22
View File
@@ -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 }}
+29
View File
@@ -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
+73
View File
@@ -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
+20
View File
@@ -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 }}
+88
View File
@@ -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 }}
+22
View File
@@ -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 }}
+99
View File
@@ -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