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 new file mode 100644 index 00000000..ca60babc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,143 @@ +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-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: 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-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: 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/.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/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)