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

Adding publish step in ci #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
79 changes: 79 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "Test"

on:
push:
branches:
- "main"
paths:
# Always run when workflow configs change
- ".github/workflows/**"
# Run when package changes
- "**"
release:
types: [published]

pull_request:
branches:
- "main"
paths:
# Always run when workflow configs change
- ".github/workflows/**"
# Run when package changes
- "**"

workflow_dispatch: {}

jobs:
test_client:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

strategy:
matrix:
python-version:
- 3.9

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
id: setup_python
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
poetry.lock

- name: Install dependencies (tests)
run: |
pip install pytest pytest-asyncio pytest-mock requests-mock

- name: Install dependencies
working-directory: .
run: |
pip install -e .

- name: Run tests
working-directory: .
run: |
echo $COHERE_API_KEY
pytest -sv tests/test_compass_client.py
pypi-publish:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- test_client
permissions:
id-token: write

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f
ankush-cohere marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ jobs:
working-directory: .
run: |
echo $COHERE_API_KEY
pytest -sv tests/test_compass_client.py
pytest -sv tests/test_compass_client.py
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "compass-sdk"
version = "0.1.0"
version = "0.0.1"
authors = []
description = "Compass SDK"

Expand Down
Loading