From 169cc5d71717d6b3d9501fa191f4e6d78e2037e3 Mon Sep 17 00:00:00 2001 From: Mike Morgan Date: Thu, 15 Jan 2026 00:04:59 -0700 Subject: [PATCH] ci: Add GitHub Actions CI/CD workflows - Add CI workflow with lint, typecheck, test - Add release workflow for publishing on version tags - Add Codecov integration for coverage reporting - Update README with status badges Co-Authored-By: Claude Opus 4.5 --- .github/workflows/ci.yml | 70 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 53 ++++++++++++++++++++++++++ README.md | 4 ++ 3 files changed, 127 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7f5d574 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +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 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - run: pip install ruff + - run: ruff check . + - run: ruff format --check . + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - run: pip install -e ".[dev]" + - run: mypy cortex_backup + + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + - run: pip install -e ".[dev]" + - run: pytest --cov=cortex_backup --cov-report=xml + - uses: codecov/codecov-action@v4 + if: matrix.python-version == '3.11' + 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 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - run: pip install build + - run: python -m build + - 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..701c2ef --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + tags: ["v*"] + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - run: pip install build + - run: python -m build + - 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: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + - uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + - id: version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + - uses: softprops/action-gh-release@v1 + with: + name: v${{ steps.version.outputs.VERSION }} + generate_release_notes: true + files: dist/* diff --git a/README.md b/README.md index ce6a477..8a71762 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # Cortex Backup +[\![CI](https://github.com/cortexlinux/cortex-backup/actions/workflows/ci.yml/badge.svg)](https://github.com/cortexlinux/cortex-backup/actions/workflows/ci.yml) +[\![PyPI](https://img.shields.io/pypi/v/cortex-backup)](https://pypi.org/project/cortex-backup/) +[\![Python](https://img.shields.io/pypi/pyversions/cortex-backup)](https://pypi.org/project/cortex-backup/) +[\![codecov](https://codecov.io/gh/cortexlinux/cortex-backup/branch/main/graph/badge.svg)](https://codecov.io/gh/cortexlinux/cortex-backup) **AI-Assisted Backup System for Cortex Linux**