mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-28 09:28:48 +00:00
update release workflows
This commit is contained in:
parent
7a8d5586de
commit
bc24f60a39
64
.github/workflows/_release.yml
vendored
64
.github/workflows/_release.yml
vendored
@ -21,7 +21,6 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: "3.11"
|
PYTHON_VERSION: "3.11"
|
||||||
POETRY_VERSION: "1.8.4"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -36,13 +35,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
|
- name: Set up Python + uv
|
||||||
uses: "./.github/actions/poetry_setup"
|
uses: "./.github/actions/uv_setup"
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
poetry-version: ${{ env.POETRY_VERSION }}
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
cache-key: release
|
|
||||||
|
|
||||||
# We want to keep this build stage *separate* from the release stage,
|
# We want to keep this build stage *separate* from the release stage,
|
||||||
# so that there's no sharing of permissions between them.
|
# so that there's no sharing of permissions between them.
|
||||||
@ -56,7 +52,7 @@ jobs:
|
|||||||
# > from the publish job.
|
# > from the publish job.
|
||||||
# https://github.com/pypa/gh-action-pypi-publish#non-goals
|
# https://github.com/pypa/gh-action-pypi-publish#non-goals
|
||||||
- name: Build project for distribution
|
- name: Build project for distribution
|
||||||
run: poetry build
|
run: uv build
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
|
|
||||||
- name: Upload build
|
- name: Upload build
|
||||||
@ -67,11 +63,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Version
|
- name: Check Version
|
||||||
id: check-version
|
id: check-version
|
||||||
shell: bash
|
shell: python
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
run: |
|
run: |
|
||||||
echo pkg-name="$(poetry version | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
|
import os
|
||||||
echo version="$(poetry version --short)" >> $GITHUB_OUTPUT
|
import tomllib
|
||||||
|
with open("pyproject.toml", "rb") as f:
|
||||||
|
data = tomllib.load(f)
|
||||||
|
pkg_name = data["project"]["name"]
|
||||||
|
version = data["project"]["version"]
|
||||||
|
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
||||||
|
f.write(f"pkg-name={pkg_name}\n")
|
||||||
|
f.write(f"version={version}\n")
|
||||||
release-notes:
|
release-notes:
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
@ -184,13 +187,11 @@ jobs:
|
|||||||
# - The package is published, and it breaks on the missing dependency when
|
# - The package is published, and it breaks on the missing dependency when
|
||||||
# used in the real world.
|
# used in the real world.
|
||||||
|
|
||||||
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
|
- name: Set up Python + uv
|
||||||
uses: "./.github/actions/poetry_setup"
|
uses: "./.github/actions/uv_setup"
|
||||||
id: setup-python
|
id: setup-python
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
poetry-version: ${{ env.POETRY_VERSION }}
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -213,17 +214,18 @@ jobs:
|
|||||||
# - attempt install again after 5 seconds if it fails because there is
|
# - attempt install again after 5 seconds if it fails because there is
|
||||||
# sometimes a delay in availability on test pypi
|
# sometimes a delay in availability on test pypi
|
||||||
run: |
|
run: |
|
||||||
poetry run pip install dist/*.whl
|
uv venv
|
||||||
|
uv run pip install dist/*.whl
|
||||||
|
|
||||||
# Replace all dashes in the package name with underscores,
|
# Replace all dashes in the package name with underscores,
|
||||||
# since that's how Python imports packages with dashes in the name.
|
# since that's how Python imports packages with dashes in the name.
|
||||||
# also remove _official suffix
|
# also remove _official suffix
|
||||||
IMPORT_NAME="$(echo "$PKG_NAME" | sed s/-/_/g | sed s/_official//g)"
|
IMPORT_NAME="$(echo "$PKG_NAME" | sed s/-/_/g | sed s/_official//g)"
|
||||||
|
|
||||||
poetry run python -c "import $IMPORT_NAME; print(dir($IMPORT_NAME))"
|
uv run python -c "import $IMPORT_NAME; print(dir($IMPORT_NAME))"
|
||||||
|
|
||||||
- name: Import test dependencies
|
- name: Import test dependencies
|
||||||
run: poetry install --with test --no-root
|
run: uv sync --group test
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
|
|
||||||
# Overwrite the local version of the package with the built version
|
# Overwrite the local version of the package with the built version
|
||||||
@ -234,7 +236,7 @@ jobs:
|
|||||||
PKG_NAME: ${{ needs.build.outputs.pkg-name }}
|
PKG_NAME: ${{ needs.build.outputs.pkg-name }}
|
||||||
VERSION: ${{ needs.build.outputs.version }}
|
VERSION: ${{ needs.build.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
poetry run pip install dist/*.whl
|
uv run pip install dist/*.whl
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: make tests
|
run: make tests
|
||||||
@ -243,15 +245,15 @@ jobs:
|
|||||||
- name: Check for prerelease versions
|
- name: Check for prerelease versions
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
run: |
|
run: |
|
||||||
poetry run python $GITHUB_WORKSPACE/.github/scripts/check_prerelease_dependencies.py pyproject.toml
|
uv run python $GITHUB_WORKSPACE/.github/scripts/check_prerelease_dependencies.py pyproject.toml
|
||||||
|
|
||||||
- name: Get minimum versions
|
- name: Get minimum versions
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
id: min-version
|
id: min-version
|
||||||
run: |
|
run: |
|
||||||
poetry run pip install packaging requests
|
uv run pip install packaging requests
|
||||||
python_version="$(poetry run python --version | awk '{print $2}')"
|
python_version="$(uv run python --version | awk '{print $2}')"
|
||||||
min_versions="$(poetry run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml release $python_version)"
|
min_versions="$(uv run python $GITHUB_WORKSPACE/.github/scripts/get_min_versions.py pyproject.toml release $python_version)"
|
||||||
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
|
echo "min-versions=$min_versions" >> "$GITHUB_OUTPUT"
|
||||||
echo "min-versions=$min_versions"
|
echo "min-versions=$min_versions"
|
||||||
|
|
||||||
@ -260,12 +262,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MIN_VERSIONS: ${{ steps.min-version.outputs.min-versions }}
|
MIN_VERSIONS: ${{ steps.min-version.outputs.min-versions }}
|
||||||
run: |
|
run: |
|
||||||
poetry run pip install --force-reinstall $MIN_VERSIONS --editable .
|
uv run pip install --force-reinstall $MIN_VERSIONS --editable .
|
||||||
make tests
|
make tests
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
|
|
||||||
- name: Import integration test dependencies
|
- name: Import integration test dependencies
|
||||||
run: poetry install --with test,test_integration
|
run: uv sync --group test --group test_integration
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
@ -331,13 +333,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
|
- name: Set up Python + uv
|
||||||
uses: "./.github/actions/poetry_setup"
|
uses: "./.github/actions/uv_setup"
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
poetry-version: ${{ env.POETRY_VERSION }}
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
cache-key: release
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -373,13 +372,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
|
- name: Set up Python + uv
|
||||||
uses: "./.github/actions/poetry_setup"
|
uses: "./.github/actions/uv_setup"
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
poetry-version: ${{ env.POETRY_VERSION }}
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
cache-key: release
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
23
.github/workflows/_test_release.yml
vendored
23
.github/workflows/_test_release.yml
vendored
@ -14,7 +14,6 @@ on:
|
|||||||
description: "Release from a non-master branch (danger!)"
|
description: "Release from a non-master branch (danger!)"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
POETRY_VERSION: "1.8.4"
|
|
||||||
PYTHON_VERSION: "3.10"
|
PYTHON_VERSION: "3.10"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -29,13 +28,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
|
- name: Set up Python + uv
|
||||||
uses: "./.github/actions/poetry_setup"
|
uses: "./.github/actions/uv_setup"
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
poetry-version: ${{ env.POETRY_VERSION }}
|
|
||||||
working-directory: ${{ inputs.working-directory }}
|
|
||||||
cache-key: release
|
|
||||||
|
|
||||||
# We want to keep this build stage *separate* from the release stage,
|
# We want to keep this build stage *separate* from the release stage,
|
||||||
# so that there's no sharing of permissions between them.
|
# so that there's no sharing of permissions between them.
|
||||||
@ -49,7 +45,7 @@ jobs:
|
|||||||
# > from the publish job.
|
# > from the publish job.
|
||||||
# https://github.com/pypa/gh-action-pypi-publish#non-goals
|
# https://github.com/pypa/gh-action-pypi-publish#non-goals
|
||||||
- name: Build project for distribution
|
- name: Build project for distribution
|
||||||
run: poetry build
|
run: uv build
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
|
|
||||||
- name: Upload build
|
- name: Upload build
|
||||||
@ -60,11 +56,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Check Version
|
- name: Check Version
|
||||||
id: check-version
|
id: check-version
|
||||||
shell: bash
|
shell: python
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
run: |
|
run: |
|
||||||
echo pkg-name="$(poetry version | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
|
import os
|
||||||
echo version="$(poetry version --short)" >> $GITHUB_OUTPUT
|
import tomllib
|
||||||
|
with open("pyproject.toml", "rb") as f:
|
||||||
|
data = tomllib.load(f)
|
||||||
|
pkg_name = data["project"]["name"]
|
||||||
|
version = data["project"]["version"]
|
||||||
|
with open(os.environ["GITHUB_OUTPUT"], "a") as f:
|
||||||
|
f.write(f"pkg-name={pkg_name}\n")
|
||||||
|
f.write(f"version={version}\n")
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs:
|
needs:
|
||||||
|
Loading…
Reference in New Issue
Block a user