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

Add new setup-poetry action and fix nightly-release #212

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Setup Poetry'
description: 'Installs Poetry and dependencies'
runs:
using: 'composite'
steps:
- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
shell: bash
run: |
poetry install

# We separate the gRPC dependencies from the REST client's install
# behavior, so we test installing the grpc dependencies here as well
# The dependencies that are specific to gRPC are defined in pyproject.toml
# under tool.poetry.extras
- name: Install gRPC dependencies
shell: bash
run: |
poetry install --extras "grpc"
3 changes: 3 additions & 0 deletions .github/workflows/nightly-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
with:
python-version: 3.x

- name: Setup Poetry
uses: ./.github/actions/setup-poetry

- name: Build Python client
run: make package

Expand Down
32 changes: 18 additions & 14 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
description: 'Git ref to build (branch name or SHA)'
required: true
type: string
default: 'main'
default: 'main'
releaseLevel:
description: 'Release level'
required: true
Expand Down Expand Up @@ -59,10 +59,10 @@ jobs:
id: bump
uses: './.github/actions/bump-version'
with:
versionFile: pinecone/__version__
versionFile: pinecone/__version__
bumpType: ${{ inputs.releaseLevel }}
prereleaseSuffix: ${{ inputs.prereleaseSuffix }}

- name: Verify unique release number
run: |
TAG_NAME=${{ steps.bump.outputs.VERSION_TAG }}
Expand All @@ -71,19 +71,23 @@ jobs:
exit 1
fi

- name: Poetry bump pyproject toml version
run: |
poetry version ${{ inputs.releaseLevel }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Setup Poetry
uses: ./.github/actions/setup-poetry

- name: Set up Git
run: |
git config --global user.name "Pinecone CI"
git config --global user.email "[email protected]"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this up, did a tiny bit of organizing steps in here.

- uses: actions/setup-python@v4
with:
python-version: 3.x

- name: Poetry bump pyproject toml version
run: |
poetry version ${{ inputs.releaseLevel }}

- name: Build Python client
run: make package

Expand All @@ -99,7 +103,7 @@ jobs:
if: ${{ inputs.isPrerelease == true }}
run: |
git checkout pinecone/__version__

- name: Commit changes, if not prerelease
if: ${{ inputs.isPrerelease == false }}
run: |
Expand All @@ -119,14 +123,14 @@ jobs:
run: |
newVersionTag="${{ steps.bump.outputs.VERSION_TAG }}"
git tag -a $newVersionTag -m "Release $newVersionTag"

- name: Push tags (prerelease)
if: ${{ inputs.isPrerelease == true }}
# In the case of the prerelease, we discarded the version changes
# instead of committing them. So we need a slightly different
# command to push the git tag we created.
run: git push --tags

- name: Push tags (production release)
if: ${{ inputs.isPrerelease == false }}
run: git push --follow-tags
44 changes: 14 additions & 30 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Testing

on:
on:
workflow_call: {}

jobs:
Expand All @@ -12,37 +12,21 @@ jobs:
python-version: [3.8, 3.9, '3.10', 3.11]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python -
- name: Setup Poetry
uses: ./.github/actions/setup-poetry

- name: Install dependencies
run: |
poetry install
- name: Run tests
run: make tests

# We separate the gRPC dependencies from the REST client's install
# behavior, so we test installing the grpc dependencies here as well
# The dependencies that are specific to gRPC are defined in pyproject.toml
# under tool.poetry.extras
- name: Install gRPC dependencies
run: |
poetry install --extras "grpc"
- name: Build Python client
run: make package

- name: Run tests
run: make tests

- name: Build Python client
run: make package

- name: Build docs
run: make docs

- name: Build Project
run: poetry build
Comment on lines -47 to -48
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, we're calling make package above which is essentially an alias for poetry build, don't think we need to call it again.

- name: Build docs
run: make docs