Skip to content

chore: Add no key in env support #20

chore: Add no key in env support

chore: Add no key in env support #20

Workflow file for this run

name: CI
on:
push:
branches: [development]
pull_request:
branches: [development]
workflow_dispatch: # Manual trigger
jobs:
test:
runs-on: ubuntu-latest
env: # Define environment variables here
PYTHON_VERSION: "3.11"
COVERAGE_THRESHOLD: 20 # Set to 80% in production
BRANCH: development
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: |
poetry install --no-interaction --with dev
- name: Display installed packages
run: |
poetry show
- name: Investigate Pinecone library
run: |
echo "Pinecone library content:"
cat .venv/lib/python${{ env.PYTHON_VERSION }}/site-packages/pinecone/control/pinecone.py
- name: Run unit tests with coverage report
run: |
poetry run python -m pytest -v --cov=./src --cov-report term-missing:skip-covered tests || echo "Some tests failed, but continuing workflow"
- name: Check coverage
run: |
poetry run coverage report -m
COVERAGE=$(poetry run coverage report -m | grep -Po '^TOTAL.*\s(\d+%)$' | awk '{sub("%", "", $NF); print $NF}')
echo "Coverage is $COVERAGE%"
if [ "$COVERAGE" -lt "${{ env.COVERAGE_THRESHOLD }}" ]; then
echo "Warning: Coverage is below ${{ env.COVERAGE_THRESHOLD }}%"
fi
- name: Python Semantic Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name github-actions
git config user.email [email protected]
poetry run semantic-release version
poetry run semantic-release publish
- name: Check if release was created
id: check-release
run: |
if [ -n "$(git tag --points-at HEAD)" ]; then
echo "RELEASE_CREATED=true" >> $GITHUB_ENV
else
echo "RELEASE_CREATED=false" >> $GITHUB_ENV
fi
- name: Merge development into main if release created
if: ${{ env.RELEASE_CREATED == 'true' }}
run: |
git checkout main
git merge --ff-only $BRANCH
git push origin main