Skip to content

Commit

Permalink
Refactor CI test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jhamon committed Nov 4, 2023
1 parent 42b26cb commit b61f3f0
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 10 deletions.
6 changes: 6 additions & 0 deletions .github/actions/setup-poetry/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: 'Setup Poetry'
description: 'Installs Poetry and dependencies'
inputs:
include_grpc:
description: 'Install gRPC dependencies'
required: true
default: 'true'
runs:
using: 'composite'
steps:
Expand All @@ -16,6 +21,7 @@ runs:
# The dependencies that are specific to gRPC are defined in pyproject.toml
# under tool.poetry.extras
- name: Install gRPC dependencies
if: ${{ inputs.include_grpc == 'true' }}
shell: bash
run: |
poetry install --extras "grpc"
54 changes: 47 additions & 7 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_call: {}

jobs:
run-tests:
units-no-grpc:
name: Run tests
runs-on: ubuntu-latest
strategy:
Expand All @@ -21,12 +21,52 @@ jobs:

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

- name: Run unit tests
run: poetry run pytest --cov=pinecone --timeout=120 tests/unit

units-grpc:
name: Run tests (GRPC)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]

steps:
- uses: actions/checkout@v3

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

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

- name: Run tests
run: make tests
- name: Run unit tests (GRPC)
run: poetry run pytest --cov=pinecone --timeout=120 tests/unit_grpc

- name: Build Python client
run: make package
package:
name: Check packaging
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', 3.11]

steps:
- uses: actions/checkout@v3

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

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

- name: Build docs
run: make docs
- name: Package
run: poetry build
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ image:
develop:
poetry install -E grpc

tests:
@echo "Installing dependencies..."
poetry install
test-unit:
@echo "Running tests..."
poetry run pytest --cov=pinecone --timeout=120 tests/unit

test-grpc-unit:
@echo "Running tests..."
poetry run pytest --cov=pinecone --timeout=120 tests/unit_grpc

version:
poetry version

Expand Down

0 comments on commit b61f3f0

Please sign in to comment.