diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ef75955 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,107 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff + + - name: Lint with Ruff + run: ruff check . + + - name: Check formatting + run: ruff format --check . + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Type check with mypy + run: mypy cortex_llm + + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run tests with coverage + run: pytest --cov=cortex_llm --cov-report=xml + + - name: Upload coverage to Codecov + if: matrix.python-version == '3.11' + uses: codecov/codecov-action@v4 + with: + files: ./coverage.xml + fail_ci_if_error: false + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + build: + runs-on: ubuntu-latest + needs: [lint, typecheck, test] + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install build tools + run: pip install build + + - name: Build package + run: python -m build + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3fe5e82 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,73 @@ +name: Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install build tools + run: pip install build + + - name: Build package + run: python -m build + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish-pypi: + runs-on: ubuntu-latest + needs: build + environment: pypi + permissions: + id-token: write + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Extract version from tag + id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + name: v${{ steps.version.outputs.VERSION }} + draft: false + prerelease: ${{ contains(github.ref, '-') }} + generate_release_notes: true + files: dist/* diff --git a/README.md b/README.md index 8ea22c4..e7441e1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Cortex LLM +[![CI](https://github.com/cortexlinux/cortex-llm/actions/workflows/ci.yml/badge.svg)](https://github.com/cortexlinux/cortex-llm/actions/workflows/ci.yml) +[![PyPI](https://img.shields.io/pypi/v/cortex-llm)](https://pypi.org/project/cortex-llm/) +[![Python](https://img.shields.io/pypi/pyversions/cortex-llm)](https://pypi.org/project/cortex-llm/) +[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE) +[![codecov](https://codecov.io/gh/cortexlinux/cortex-llm/branch/main/graph/badge.svg)](https://codecov.io/gh/cortexlinux/cortex-llm) + Local LLM inference runtime for Cortex Linux. Run large language models on your own hardware with GPU acceleration. ## Features