Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automate CI/CD Workflow] #89

Merged
merged 75 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
a48299a
Merge pull request #87 from SylphAI-Inc/main
Sylph-AI Jul 6, 2024
8cf087a
automate the publish release
Alleria1809 Jul 7, 2024
9446b5d
Merge remote-tracking branch 'origin/main' into release
Alleria1809 Jul 7, 2024
b82e4c1
Merge remote-tracking branch 'origin/release' into release
Alleria1809 Jul 7, 2024
84c2c67
release version test
Alleria1809 Jul 7, 2024
b3dbfa6
release version test
Alleria1809 Jul 7, 2024
6f1ea07
release version test workflow
Alleria1809 Jul 7, 2024
83e7830
sync toml file with release version
Alleria1809 Jul 7, 2024
3c4f399
sync toml file with release version
Alleria1809 Jul 7, 2024
ff2e624
sync toml file with release version
Alleria1809 Jul 7, 2024
bc6e051
test version release
Alleria1809 Jul 7, 2024
2685704
test version release
Alleria1809 Jul 7, 2024
c594c21
test version release
Alleria1809 Jul 7, 2024
fa83a79
fix errors of the workflow
Alleria1809 Jul 7, 2024
d09b2c5
reset the version back to original after testing
Alleria1809 Jul 7, 2024
dbc6257
hide the test publish yaml
Alleria1809 Jul 7, 2024
93437c0
update the automate release workflow, adding test and rollbacks
Alleria1809 Jul 8, 2024
55e4993
validate if the pr is a tag
Alleria1809 Jul 8, 2024
e825ed7
test version release
Alleria1809 Jul 8, 2024
cc6ffc6
test version release
Alleria1809 Jul 8, 2024
9142e2a
test version release
Alleria1809 Jul 8, 2024
8b65130
reset the version back to original after testing
Alleria1809 Jul 8, 2024
554efbf
test version release
Alleria1809 Jul 8, 2024
69426e0
update the tag
Alleria1809 Jul 8, 2024
93ebb8a
update the tag
Alleria1809 Jul 8, 2024
20c592e
update the toml version
Alleria1809 Jul 8, 2024
9eb1103
update the toml version
Alleria1809 Jul 8, 2024
27b65f8
test version release
Alleria1809 Jul 8, 2024
e6ee32d
test version release
Alleria1809 Jul 8, 2024
a173d7c
test version release
Alleria1809 Jul 8, 2024
614d91d
update the version control guide
Alleria1809 Jul 8, 2024
9d964a9
update the version control guide
Alleria1809 Jul 9, 2024
67231dc
reset the version back to original after testing
Alleria1809 Jul 9, 2024
fcd531e
update the instruction
Alleria1809 Jul 9, 2024
cd066dc
Rebase on main
liyin2015 Jul 9, 2024
14ceef1
update the tutorial
Alleria1809 Jul 9, 2024
2a68d6a
add tokenization example
Alleria1809 Jul 9, 2024
7e819df
update tutorial
Alleria1809 Jul 9, 2024
bb70a9d
update tutorial
Alleria1809 Jul 9, 2024
8defe13
Merge branch 'release' of https://github.com/SylphAI-Inc/LightRAG int…
Alleria1809 Jul 9, 2024
50600d2
sync tutorial
Alleria1809 Jul 9, 2024
f5a6a20
Merge pull request #99 from SylphAI-Inc/main
Sylph-AI Jul 9, 2024
21f9b42
remove unnecessary doc
Alleria1809 Jul 10, 2024
ee314b1
update the contribution guide
Alleria1809 Jul 10, 2024
fbdcd1c
update text splitter
Alleria1809 Jul 10, 2024
6f5b17b
update contribution guide
Alleria1809 Jul 10, 2024
e8c5cb1
update contribution guide
Alleria1809 Jul 10, 2024
80f607c
update the download dashboard link
Alleria1809 Jul 11, 2024
85d859e
hide the version control
Alleria1809 Jul 11, 2024
1911ee2
update the contribution guide
Alleria1809 Jul 11, 2024
1d0ffe3
Merge remote-tracking branch 'origin/main' into release
Alleria1809 Jul 11, 2024
1049549
temporarily hide the contributor
Alleria1809 Jul 11, 2024
682e66a
Merge pull request #105 from SylphAI-Inc/main
Sylph-AI Jul 11, 2024
97d7084
test the deployment
Alleria1809 Jul 12, 2024
be71a38
Merge remote-tracking branch 'origin/release' into release
Alleria1809 Jul 12, 2024
4697b57
update python version
Alleria1809 Jul 12, 2024
354dd53
update python version
Alleria1809 Jul 12, 2024
ef3cb0f
update release deployment test
Alleria1809 Jul 12, 2024
68535d4
update release deployment test
Alleria1809 Jul 12, 2024
9f330ae
update release deployment test
Alleria1809 Jul 12, 2024
0bd4e61
reset toml
Alleria1809 Jul 12, 2024
7feef6a
update workflow
Alleria1809 Jul 12, 2024
68ffcbb
update workflow
Alleria1809 Jul 12, 2024
13aad73
update workflow and set 3.10 aside
Alleria1809 Jul 12, 2024
41b0c84
update workflow test
Alleria1809 Jul 12, 2024
684e6a5
address conflicts to main
liyin2015 Jul 12, 2024
fdcf692
Merge pull request #111 from SylphAI-Inc/main
liyin2015 Jul 12, 2024
f50b9b6
update workflow test
Alleria1809 Jul 12, 2024
dc28ef6
Merge remote-tracking branch 'origin/main' into release
Alleria1809 Jul 12, 2024
cb191eb
Merge remote-tracking branch 'origin/release' into release
Alleria1809 Jul 12, 2024
3f5f001
update workflow test
Alleria1809 Jul 12, 2024
8eeb734
update workflow test
Alleria1809 Jul 12, 2024
e2f2c43
update version
Alleria1809 Jul 12, 2024
01fb78c
version update
Alleria1809 Jul 12, 2024
aaa09fb
rebase on main
liyin2015 Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Publish the latest release on PyPI

on:
Copy link
Member

@liyin2015 liyin2015 Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets trigger on pr merge on release that we have to sort it out

on:
  pull_request:
    types: [closed]
    branches:
      - main

and there is also stable and not stable release

Copy link
Contributor Author

@Alleria1809 Alleria1809 Jul 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I considered this, setting it to trigger on PRs that have a tag is more flexible and will be the future workflow. Setting it to main is more of centralized control for now.

I'd check more about stable and not stable release. I currently refer to llamaindex, langchain, etc.

push:
tags:
- 'v*'
branches:
- release
workflow_dispatch:
inputs:
version:
description: 'Override the version number'
required: false
rollback:
description: 'Trigger a rollback to the previous stable version'
required: false
default: false

jobs:
validate-tag:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Validate Tag Format
run: |
TAG_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\-\.]+)?$'
echo "Regex to match: $TAG_REGEX"
TAG="${GITHUB_REF/refs\/tags\//}"
echo "Tag extracted: $TAG"
if [[ "$TAG" =~ $TAG_REGEX ]]; then
echo "Tag format is valid."
else
echo "::error::Tag $TAG does not match the 'vMAJOR.MINOR.PATCH' or 'vMAJOR.MINOR.PATCH-pre-release' format."
exit 1
fi
shell: bash

build-and-package:
needs: validate-tag
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Change to the lightrag directory and install dependencies
run: |
cd lightrag
poetry install --no-dev
- name: Build the distribution
run: |
cd lightrag
poetry build
- name: Upload distribution for publishing
uses: actions/upload-artifact@v2
with:
name: dist
path: lightrag/dist/


dry-run-publish:
needs: build-and-package
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download distribution
uses: actions/download-artifact@v2
with:
name: dist
path: lightrag/dist/
- name: Install Poetry and perform dry run publish
run: |
python -m pip install --upgrade pip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like overlap and repeating previous steps, not sure this is what you have designed on the workflow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just a duplication. I will remove this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its stil repeating, im not sure why this has to be separate from the first,

pip install poetry
cd lightrag
poetry publish --dry-run -v

publish-to-pypi:
needs:
- validate-tag
- build-and-package
- dry-run-publish
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Download distribution
uses: actions/download-artifact@v2
with:
name: dist
path: lightrag/dist/
- name: Install Poetry and publish to PyPI
run: |
python -m pip install --upgrade pip
pip install poetry
cd lightrag
poetry publish --username __token__ --password ${{ secrets.PYPI_KEY }} --verbose

create-github-release:
needs: publish-to-pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create Release on GitHub
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: 'Automated release of version ${{ github.ref_name }}'
draft: false
prerelease: false

rollback:
needs: publish-to-pypi
if: ${{ github.event.inputs.rollback == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Rollback to previous stable version
run: |
echo "Rolling back to previous stable version..."
# Add rollback logic here
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- [![Dependency Status](https://img.shields.io/librariesio/github/SylphAI-Inc/LightRAG?style=flat-square)](https://libraries.io/github/SylphAI-Inc/LightRAG) -->
[![License](https://img.shields.io/github/license/SylphAI-Inc/LightRAG)](https://opensource.org/license/MIT)
[![PyPI](https://img.shields.io/pypi/v/lightRAG?style=flat-square)](https://pypi.org/project/lightRAG/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/lightRAG?style=flat-square)](https://pypistats.org/packages/lightRAG)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/lightRAG?style=flat-square)](https://pypistats.org/packages/lightrag)
[![GitHub star chart](https://img.shields.io/github/stars/SylphAI-Inc/LightRAG?style=flat-square)](https://star-history.com/#SylphAI-Inc/LightRAG)
[![Open Issues](https://img.shields.io/github/issues-raw/SylphAI-Inc/LightRAG?style=flat-square)](https://github.com/SylphAI-Inc/LightRAG/issues)
[![](https://dcbadge.vercel.app/api/server/zt2mTPcu?compact=true&style=flat)](https://discord.gg/zt2mTPcu)
Expand Down
96 changes: 96 additions & 0 deletions docs/source/contributor/contribute_to_code.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Contribute to Code
======================================
This document will cover how you can contribute to lightRAG codebase.

Set Up
^^^^^^^^^^^^^^^^^^^
The current ``LightRAG`` code contribution supports `poetry <https://python-poetry.org/>`_ setup only. The team is working on optimizing the library and will get back to support more environment soon.
If you are only interested in using ``LightRAG`` as a package, please check our `installation guide <https://lightrag.sylph.ai/get_started/installation.html#install-lightrag>`_.

To set up ``poetry`` and contribute, please check the following steps:

1. **Clone the Repository:**

.. code-block:: bash

git clone https://github.com/SylphAI-Inc/LightRAG
cd LightRAG

2. **Configure API Keys:**

Copy the example environment file and add your API keys:

.. code-block:: bash

cp .env.example .env
# example API keys:
# OPENAI_API_KEY=YOUR_API_KEY_IF_YOU_USE_OPENAI
# GROQ_API_KEY=YOUR_API_KEY_IF_YOU_USE_GROQ
# ANTHROPIC_API_KEY=YOUR_API_KEY_IF_YOU_USE_ANTHROPIC
# GOOGLE_API_KEY=YOUR_API_KEY_IF_YOU_USE_GOOGLE
# COHERE_API_KEY=YOUR_API_KEY_IF_YOU_USE_COHERE
# HF_TOKEN=YOUR_API_KEY_IF_YOU_USE_HF

3. **Install Dependencies:**

The ``./lightrag/pyproject.toml`` controls the dependencies for the ``LightRAG`` package.
Use Poetry to install the dependencies and set up the virtual environment:

.. code-block:: bash
cd lightrag
poetry install
poetry shell

Codebase Structure
^^^^^^^^^^^^^^^^^^^
It is recommended to check our `LightRAG codebase structure <https://lightrag.sylph.ai/developer_notes/index.html>`_ and current `API references <https://lightrag.sylph.ai/apis/index.html>`_ to familiarize yourself with the directories and paths before contributing.

Code Examples
^^^^^^^^^^^^^^^^^^^
We want to support you with our best. We have included code samples in the `tutorial <https://lightrag.sylph.ai/developer_notes/index.html>`_ for you to refer to.

We inlcude a list of potential samples(`We are working in progress to add more`):

- `ModelClient integration <https://lightrag.sylph.ai/developer_notes/model_client.html#model-inference-sdks>`_. This document will help if you want to add new models not included in our codebase.
- `Retriever Integration <https://lightrag.sylph.ai/developer_notes/retriever.html#retriever-in-action>`_. We provide different retrivers but you can create more.

Code Tips
^^^^^^^^^^^^^^^^^^^
* When writing code, it is appreciated to include any important docstrings and comments. Please refer to `documentation contribution guidelines <./contribute_to_document.html>`_ for standard docstrings.
* LightRAG is a Python library and if you could follow the `Google Python Style Guide <https://google.github.io/styleguide/pyguide.html>`_, the codebase will be more consistent.

Dependencies
^^^^^^^^^^^^^^^^^^^
If you want to add any new dependencies to the package, please include them in your PR description to inform us.
Since we have already set up the testing automatic workflow in GitHub, please also set your new dependencies in
``./lightrag/pyproject.toml`` file ``[tool.poetry.group.test.dependencies]`` section to avoid dependency errors in our CI/CD workflow.

In order to correctly add the dependency using ``poetry``, please run

.. code-block:: bash

poetry add --group test <package-name>

Testing
^^^^^^^^^^^^^^^^^^^
After you update the code, please make sure your code is well tested before making a pull request.
There is a ``./lightrag/tests`` folder in the project directory to host your unit testing cases.

You might need to install the testing packages using ``poetry``:

For example:

.. code-block:: bash

poetry add --group test unittest
poetry add --group test pytest
poetry add --group test mypy


All the test scripts should start with ``test_``. For example, run the individual test for ``components`` with:

.. code-block:: bash

python lightrag/tests/test_components.py


20 changes: 10 additions & 10 deletions docs/source/contributor/contribute_to_document.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
Contribute to Document
Contribute to Documentation
===============================================

.. contents::
:local:
:depth: 2

.. _Writing documentation:

Writing Documentation
---------------------------
.. _Documentation Contribution:

- **User-Facing Documentation**: Found on the main docs site. These include tutorials, guides, and usage documentation meant for end users.
- **Developer Documentation**: Located within the repository's READMEs and the ``docs/`` directory. These documents are more technical and intended for contributors and maintainers.
Expand All @@ -35,14 +32,14 @@ Setup & Build Documentation

**2. Install Necessary Packages**

LightRAG's documentation style is `pydata_sphinx_theme <https://pydata-sphinx-theme.readthedocs.io/en/stable/>`_ (version: 0.15.3).
LightRAG's documentation style is `pydata_sphinx_theme <https://pydata-sphinx-theme.readthedocs.io/en/stable/>`_.

Install by ``pip``:
.. Install by ``pip``:

.. code-block:: bash
.. .. code-block:: bash

cd docs
pip install -r requirements.txt
.. cd docs
.. pip install -r requirements.txt

Install by ``poetry`` along with all other dependencies for LightRAG:

Expand Down Expand Up @@ -107,6 +104,9 @@ To manually run these tests, run:
make doctest


Documentation Dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If your documentation requires any new dependencies, please include it in the ``pyproject.toml`` under the root directory, include it in your PR description and let us know.

Commit Changes
~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
63 changes: 63 additions & 0 deletions docs/source/contributor/contribution.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
LightRAG Contribution Guide
=======================================
``LightRAG``'s contribution process is similar to most open source projects on GitHub. We encourage new project ideas and the communication between ``LightRAG`` team, developers and the broader community.
Please don't forget to join us on `Discord <https://discord.com/invite/ezzszrRZvT>`_.

Contribution Process
----------------------------
You are always welcomed to contribute even if you've never participated in open source project before.
Here is the basic contribution process:

Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When contributing, please note:
LightRAG separates the source code environment and documentation environment.

* To activate the code environment, you should run ``poetry install`` and ``poetry shell`` under ``./lightrag``. The ``./lightrag/pyproject.toml`` contains the dependencies for the ``LightRAG`` package.

* To activate the documentation environment, you can run ``poetry install`` and ``poetry shell`` under ``.``. The ``./pyproject.toml`` controls documentation dependencies.

Find a direction to work on
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The team builds ``LightRAG`` based on latest researches and product cases. But you might have your own task to apply ``LightRAG``.
Therefore, you can extend ``LightRAG`` and add any new features you believe will solve yours or others' problems.
If you don't have any idea yet, you can:

* Check the `existing issues <https://github.com/SylphAI-Inc/LightRAG/issues>`_ and see if there is anyone you know how to fix or you'd love to fix.

* Join us on `Discord <https://discord.com/invite/ezzszrRZvT>`_. We are glad to discuss with you and know what you are interested in here.

Figure out the scope of your change
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**Small:** Most of the pull requests are small. If your change is small, such as fixing a line of bug, please go ahead to push it.

**Big:** But if you are making a new feature, or planning to push a large change, it is recommended to contact us on `Discord <https://discord.com/invite/ezzszrRZvT>`_ first.

**Unknown:** If you have no idea how big it will be, we are here to help you. Please post your idea on `issues <https://github.com/SylphAI-Inc/LightRAG/issues>`_. We will read it carefully and get back to you.

Add your code
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please check our `code contribution guidelines <./contribute_to_code.html>`_ to work with code.

Pull requests
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
**WIP PR:** If you are working on an in pull request that is not ready for review, you can create a PR with **"[WIP]"** to inform us that this PR is a draft **“work in progress”**.

**Finished PR:** You can name your finished PR as **"[New Retriever Integration]"** for example.
We will carry out code review regularly and provide feedbacks as soon as possible.
Please iterate your PR with the feedbacks. We will try our best to reduce the revision workload on your side.
Once your PR is approved, we will merge the PR for you.
If you have any concerns about our feedbacks, please feel free to contact us on `Discord <https://discord.com/invite/ezzszrRZvT>`_.

Writing Documentation
----------------------------
It is a good practice to submit your code with documentations to help the ``LightRAG`` team and other developers better understand your updates.
Please see our `documentation contribution guidelines <./contribute_to_document.html>`_ for more details on ``LightRAG`` documentation standard.




.. admonition:: Resources
:class: highlight


6 changes: 0 additions & 6 deletions docs/source/contributor/contribution_guide.rst

This file was deleted.

6 changes: 4 additions & 2 deletions docs/source/contributor/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ For Contributors
.. toctree::
:maxdepth: 2

contribution_guide
contribute_to_document
contribution
contribute_to_code
contribute_to_document
.. version_control
Loading
Loading