From 98bafe044ddef18739d7ebe8167c21b60267c7ac Mon Sep 17 00:00:00 2001 From: Robert Shelton Date: Tue, 30 Apr 2024 10:50:20 -0400 Subject: [PATCH 1/3] safe version of release file --- .github/workflows/release.yml | 146 ++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d7d7bce6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,146 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Version of this deployment' + required: true + +env: + PYTHON_VERSION: "3.11" + POETRY_VERSION: "1.4.2" + +jobs: + build: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + + - name: Set Version + run: poetry version ${{ github.event.inputs.version }} + + - name: Build package + run: poetry build + + - name: Upload build + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + test-pypi-publish: + needs: build + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + pre-release-checks: + needs: test-pypi-publish + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + + - name: Install dependencies + run: | + poetry install --all-extras + - name: Install published package from TestPyPI + run: | + poetry run pip install --index-url https://test.pypi.org/simple/ --no-deps redisvl==${{ github.event.inputs.version }} + - name: Run tests + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }} + GCP_LOCATION: ${{ secrets.GCP_LOCATION }} + GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} + COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} + AZURE_OPENAI_API_KEY: ${{secrets.AZURE_OPENAI_API_KEY}} + AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}} + AZURE_OPENAI_DEPLOYMENT_NAME: ${{secrets.AZURE_OPENAI_DEPLOYMENT_NAME}} + OPENAI_API_VERSION: ${{secrets.OPENAI_API_VERSION}} + run: | + poetry run test-cov + # publish: + # needs: pre-release-checks + # runs-on: ubuntu-22.04 + + # steps: + # - uses: actions/checkout@v4 + + # - name: Set up Python + # uses: actions/setup-python@v4 + # with: + # python-version: ${{ env.PYTHON_VERSION }} + + # - name: Install Poetry + # uses: snok/install-poetry@v1 + + # - uses: actions/download-artifact@v4 + # with: + # name: dist + # path: dist/ + + # - name: Publish to PyPI + # env: + # POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI }} + # run: poetry publish + + # create-release: + # needs: publish + # runs-on: ubuntu-22.04 + + # steps: + # - uses: actions/checkout@v4 + + # - uses: actions/download-artifact@v4 + # with: + # name: dist + # path: dist/ + + # - name: Create Release + # uses: ncipollo/release-action@v1 + # with: + # artifacts: "dist/*" + # token: ${{ secrets.GITHUB_TOKEN }} + # draft: false + # generateReleaseNotes: true + # tag: ${{ github.event.inputs.version }} + # commit: main \ No newline at end of file From 291110ec0c7091fd08e5b7051e24c5a4b9880437 Mon Sep 17 00:00:00 2001 From: Robert Shelton Date: Tue, 30 Apr 2024 11:09:10 -0400 Subject: [PATCH 2/3] Update release.yml add push branch --- .github/workflows/release.yml | 43 +++++++++++++++++------------------ .gitignore | 3 ++- pyproject.toml | 4 ++-- scripts.py | 22 +++++++++--------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7d7bce6..4715bb2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,9 @@ name: Release on: + # TODO: remove + push: + branches: [ robert/build/tests ] workflow_dispatch: inputs: version: @@ -13,7 +16,7 @@ env: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -40,7 +43,7 @@ jobs: test-pypi-publish: needs: build - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -59,15 +62,13 @@ jobs: path: dist/ - name: Publish to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + env: + POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TESTPYPI }} + run: poetry config repositories.test-pypi https://test.pypi.org/legacy/; poetry config pypi-token.test-pypi $POETRY_PYPI_TOKEN_TESTPYPI; poetry publish --repository test-pypi pre-release-checks: needs: test-pypi-publish - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -80,13 +81,10 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 - - name: Install dependencies - run: | - poetry install --all-extras + # - name: Install dependencies + # run: | + # poetry install --all-extras - name: Install published package from TestPyPI - run: | - poetry run pip install --index-url https://test.pypi.org/simple/ --no-deps redisvl==${{ github.event.inputs.version }} - - name: Run tests env: OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }} GCP_LOCATION: ${{ secrets.GCP_LOCATION }} @@ -96,11 +94,12 @@ jobs: AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}} AZURE_OPENAI_DEPLOYMENT_NAME: ${{secrets.AZURE_OPENAI_DEPLOYMENT_NAME}} OPENAI_API_VERSION: ${{secrets.OPENAI_API_VERSION}} - run: | - poetry run test-cov + run: + poetry run pip install --index-url https://test.pypi.org/simple/ --no-deps redisvl-test; poetry run test-cov + # publish: # needs: pre-release-checks - # runs-on: ubuntu-22.04 + # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 @@ -118,14 +117,14 @@ jobs: # name: dist # path: dist/ - # - name: Publish to PyPI - # env: - # POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI }} - # run: poetry publish + # - name: Publish to PyPI + # env: + # POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI }} + # run: poetry publish # create-release: # needs: publish - # runs-on: ubuntu-22.04 + # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 9e24dd50..d4204a44 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ scratch wiki_schema.yaml docs/_build/ .venv -coverage.xml \ No newline at end of file +coverage.xml +dist/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e3173e8c..1193d440 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "redisvl" -version = "0.1.3" +name = "redisvl-test" +version = "0.1.3.9" description = "Python client library and CLI for using Redis as a vector database" authors = ["Redis Inc. "] license = "MIT" diff --git a/scripts.py b/scripts.py index e5b31128..c95a6d78 100644 --- a/scripts.py +++ b/scripts.py @@ -1,39 +1,39 @@ import subprocess def format(): - subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"]) - subprocess.run(["black", "./redisvl", "./tests/"]) + subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"], check=True) + subprocess.run(["black", "./redisvl", "./tests/"], check=True) def check_format(): - subprocess.run(["black", "--check", "./redisvl"]) + subprocess.run(["black", "--check", "./redisvl"], check=True) def sort_imports(): - subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"]) + subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"], check=True) def check_sort_imports(): - subprocess.run(["isort", "./redisvl", "--check-only", "--profile", "black"]) + subprocess.run(["isort", "./redisvl", "--check-only", "--profile", "black"], check=True) def check_lint(): - subprocess.run(["pylint", "--rcfile=.pylintrc", "./redisvl"]) + subprocess.run(["pylint", "--rcfile=.pylintrc", "./redisvl"], check=True) def mypy(): - subprocess.run(["python", "-m", "mypy", "./redisvl"]) + subprocess.run(["python", "-m", "mypy", "./redisvl"], check=True) def test(): - subprocess.run(["python", "-m", "pytest", "--log-level=CRITICAL"]) + subprocess.run(["python", "-m", "pytest", "--log-level=CRITICAL"], check=True) def test_verbose(): - subprocess.run(["python", "-m", "pytest", "-vv", "-s", "--log-level=CRITICAL"]) + subprocess.run(["python", "-m", "pytest", "-vv", "-s", "--log-level=CRITICAL"], check=True) def test_cov(): subprocess.run(["python", "-m", "pytest", "-vv", "--cov=./redisvl", "--cov-report=xml", "--log-level=CRITICAL"], check=True) def cov(): - subprocess.run(["coverage", "html"]) + subprocess.run(["coverage", "html"], check=True) print("If data was present, coverage report is in ./htmlcov/index.html") def test_notebooks(): - subprocess.run(["cd", "docs/", "&&", "poetry run treon", "-v"]) + subprocess.run(["cd", "docs/", "&&", "poetry run treon", "-v"], check=True) def build_docs(): subprocess.run("cd docs/ && make html", shell=True) From 744fd4e48eb82561d6cae13a9815ee1e293e2129 Mon Sep 17 00:00:00 2001 From: Tyler Hutcherson Date: Wed, 1 May 2024 14:13:21 -0400 Subject: [PATCH 3/3] clean up release workflows --- .github/workflows/lint.yml | 2 +- .github/workflows/publish.yml | 44 --------- .github/workflows/release.yml | 154 ++++++++++++++--------------- .github/workflows/test-publish.yml | 46 --------- pyproject.toml | 4 +- 5 files changed, 79 insertions(+), 171 deletions(-) delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test-publish.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ec7229fe..8d9e0ba3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,5 @@ -name: check +name: Lint on: pull_request: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index df2f3955..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: deploy-release - -on: - workflow_dispatch: - inputs: - version: - description: 'Version of this deployment' - required: true - -jobs: - build_release: - name: Build Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install Poetry - uses: snok/install-poetry@v1 - - - name: Install dependencies - run: | - poetry install --all-extras - - - name: Build package - run: poetry build - - - name: Create Release - uses: ncipollo/release-action@v1 - with: - artifacts: "dist/*" - token: ${{ secrets.GITHUB_TOKEN }} - draft: false - generateReleaseNotes: true - tag: ${{ github.event.inputs.version }} - commit: main - - - name: Publish to PyPI - env: - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI }} - run: poetry publish \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4715bb2b..ca60babc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,6 @@ name: Release on: - # TODO: remove - push: - branches: [ robert/build/tests ] workflow_dispatch: inputs: version: @@ -41,64 +38,8 @@ jobs: name: dist path: dist/ - test-pypi-publish: - needs: build - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Install Poetry - uses: snok/install-poetry@v1 - - - uses: actions/download-artifact@v4 - with: - name: dist - path: dist/ - - - name: Publish to TestPyPI - env: - POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TESTPYPI }} - run: poetry config repositories.test-pypi https://test.pypi.org/legacy/; poetry config pypi-token.test-pypi $POETRY_PYPI_TOKEN_TESTPYPI; poetry publish --repository test-pypi - - pre-release-checks: - needs: test-pypi-publish - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Install Poetry - uses: snok/install-poetry@v1 - - # - name: Install dependencies - # run: | - # poetry install --all-extras - - name: Install published package from TestPyPI - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }} - GCP_LOCATION: ${{ secrets.GCP_LOCATION }} - GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} - COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} - AZURE_OPENAI_API_KEY: ${{secrets.AZURE_OPENAI_API_KEY}} - AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}} - AZURE_OPENAI_DEPLOYMENT_NAME: ${{secrets.AZURE_OPENAI_DEPLOYMENT_NAME}} - OPENAI_API_VERSION: ${{secrets.OPENAI_API_VERSION}} - run: - poetry run pip install --index-url https://test.pypi.org/simple/ --no-deps redisvl-test; poetry run test-cov - - # publish: - # needs: pre-release-checks + # test-pypi-publish: + # needs: build # runs-on: ubuntu-latest # steps: @@ -117,29 +58,86 @@ jobs: # name: dist # path: dist/ - # - name: Publish to PyPI + # - name: Publish to TestPyPI # env: - # POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI }} - # run: poetry publish + # POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TESTPYPI }} + # run: poetry config repositories.test-pypi https://test.pypi.org/legacy/; poetry config pypi-token.test-pypi $POETRY_PYPI_TOKEN_TESTPYPI; poetry publish --repository test-pypi - # create-release: - # needs: publish + # pre-release-checks: + # needs: test-pypi-publish # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 - # - uses: actions/download-artifact@v4 + # - name: Set up Python + # uses: actions/setup-python@v4 # with: - # name: dist - # path: dist/ + # python-version: ${{ env.PYTHON_VERSION }} - # - name: Create Release - # uses: ncipollo/release-action@v1 - # with: - # artifacts: "dist/*" - # token: ${{ secrets.GITHUB_TOKEN }} - # draft: false - # generateReleaseNotes: true - # tag: ${{ github.event.inputs.version }} - # commit: main \ No newline at end of file + # - name: Install Poetry + # uses: snok/install-poetry@v1 + + # - name: Install dependencies + # run: | + # poetry install --all-extras + + # - name: Install published package from TestPyPI + # env: + # OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }} + # GCP_LOCATION: ${{ secrets.GCP_LOCATION }} + # GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} + # COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} + # AZURE_OPENAI_API_KEY: ${{secrets.AZURE_OPENAI_API_KEY}} + # AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}} + # AZURE_OPENAI_DEPLOYMENT_NAME: ${{secrets.AZURE_OPENAI_DEPLOYMENT_NAME}} + # OPENAI_API_VERSION: ${{secrets.OPENAI_API_VERSION}} + # run: + # poetry run pip install --index-url https://test.pypi.org/simple/ --no-deps redisvl-test; poetry run test-cov + + publish: + needs: build #pre-release-checks + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install Poetry + uses: snok/install-poetry@v1 + + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI }} + run: poetry publish + + create-release: + needs: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/*" + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + generateReleaseNotes: true + tag: ${{ github.event.inputs.version }} + commit: main \ No newline at end of file diff --git a/.github/workflows/test-publish.yml b/.github/workflows/test-publish.yml deleted file mode 100644 index 7af494af..00000000 --- a/.github/workflows/test-publish.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: deploy-test-release - -on: - workflow_dispatch: - inputs: - version: - description: 'Version of this deployment' - required: true - -jobs: - build_release: - name: Build Release - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install Poetry - uses: snok/install-poetry@v1 - - - name: Build package - run: | - poetry version ${{ github.event.inputs.version }} - poetry build - - - name: Create Release - uses: ncipollo/release-action@v1 - with: - artifacts: "dist/*" - token: ${{ secrets.GITHUB_TOKEN }} - draft: false - generateReleaseNotes: true - tag: ${{ github.event.inputs.version }} - commit: main - - - name: Publish to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 1193d440..e3173e8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "redisvl-test" -version = "0.1.3.9" +name = "redisvl" +version = "0.1.3" description = "Python client library and CLI for using Redis as a vector database" authors = ["Redis Inc. "] license = "MIT"