Add CI workflow for testing and linting

This commit is contained in:
tanyar09 2026-03-06 13:07:06 -05:00
parent 6364a195c5
commit 5d80eab8bd

99
.gitea/workflows/ci.yml Normal file
View File

@ -0,0 +1,99 @@
name: CI
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
jobs:
lint:
name: Lint with ruff
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.11'
- name: Install ruff
run: |
python -m pip install --upgrade pip
pip install ruff>=0.1.0
- name: Run ruff check
run: |
ruff check nanobot/
- name: Run ruff format check
run: |
ruff format --check nanobot/
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: |
pytest tests/ -v --tb=short
- name: Check package can be imported
run: |
python -c "import nanobot; print(f'nanobot version check passed')"
build:
name: Build package
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build hatchling
- name: Build package
run: |
python -m build
- name: Check build artifacts
run: |
ls -lh dist/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/
retention-days: 7