Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/coverage_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run tests and upload coverage

on:
push:
branches:
- master
paths-ignore:
- 'README.md'
- 'changelogs/**'
- 'dashboard/**'
pull_request:
workflow_dispatch:

jobs:
test:
name: Run tests and collect coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-cov
pip install --editable .

- name: Run tests
run: |
mkdir -p data/plugins
mkdir -p data/config
mkdir -p data/temp
export TESTING=true
export ZHIPU_API_KEY=${{ secrets.OPENAI_API_KEY }}
pytest --cov=astrbot -v -o log_cli=true -o log_level=DEBUG

- name: Upload results to Codecov
if: github.repository == 'AstrBotDevs/AstrBot'
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflows/install_script_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v7

- name: Check Bash installer syntax
- name: Test Bash installer
shell: bash
run: /bin/bash -n docs/public/install.sh
run: |
/bin/bash -n docs/public/install.sh
python3 tests/test_install_script.py
14 changes: 1 addition & 13 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,6 @@ jobs:
run: test -x /usr/bin/sandbox-exec

- name: Run tests
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
chmod +x scripts/run_pytests_ci.sh
if [ "${{ runner.os }}" = "Linux" ]; then
bash ./scripts/run_pytests_ci.sh ./tests --cov=astrbot --cov-report=xml
else
bash ./scripts/run_pytests_ci.sh ./tests
fi

- name: Upload coverage
if: runner.os == 'Linux' && github.repository == 'AstrBotDevs/AstrBot'
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
bash ./scripts/run_pytests_ci.sh ./tests
Loading