From 5d80eab8bd688a887c5640e5a6bad283e83fcb4e Mon Sep 17 00:00:00 2001 From: tanyar09 Date: Fri, 6 Mar 2026 13:07:06 -0500 Subject: [PATCH] Add CI workflow for testing and linting --- .gitea/workflows/ci.yml | 99 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..0b684ad --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -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 +