ci: add Gitea Actions for Python

This commit is contained in:
2026-01-22 11:35:02 +08:00
parent 248a240524
commit 2e9bf2b50c
2 changed files with 34 additions and 12 deletions

View File

@@ -1,12 +0,0 @@
kind: pipeline
type: docker
name: test
steps:
- name: run tests
image: python:3.10
commands:
- pip install --upgrade pip
- pip install -r requirements.txt
- pip install pytest
- pytest tests/

View File

@@ -0,0 +1,34 @@
name: Python Test
on:
push:
branches: [ "master", "main" ]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
fi
pip install pytest
- name: Run tests
run: |
if [ -d "tests" ]; then
pytest tests/ --verbose
else
echo "No tests directory found, skipping tests."
fi