Skip to content

chore(main): release 2.1.0 #185

chore(main): release 2.1.0

chore(main): release 2.1.0 #185

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Lint and Tests PRs
on:
pull_request:
branches:
- 'main'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
container: [ "python:3.9", "python:3.10", "python:3.11" ]
container:
image: ${{ matrix.container }}
steps:
- name: Check out src from Git
uses: actions/checkout@v4
with:
fetch-depth: 0 # this (and below) is needed to have setuptools_scm report the correct version
fetch-tags: true
- name: Upgrade pip
run: pip install --upgrade pip
- name: Create and activate Virtualenv
run: |
pip install virtualenv
[ ! -d ".venv" ] && virtualenv .venv
. .venv/bin/activate
- name: Install dependencies
run: |
pip install ".[dev]"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Make sure dist folder is empty
run: >-
rm -rf dist/*
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Run black formatter check
run: black --check confidence --exclude="telemetry_pb2.py|_version.py"
- name: Run flake8 formatter check
run: flake8 confidence --exclude=telemetry_pb2.py,_version.py,telemetry.py
- name: Run type linter check
run: mypy confidence --follow-imports=skip --exclude telemetry_pb2.py --exclude telemetry.py
- name: Run tests with pytest
run: pytest
test-installation-scenarios:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
python-version: ["3.11"]
installation-type: ["full", "minimal"]
steps:
- name: Check out src from Git
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: pip install --upgrade pip
- name: Install full dependencies (with protobuf)
if: matrix.installation-type == 'full'
run: |
pip install -e ".[dev]"
- name: Install minimal dependencies (without protobuf)
if: matrix.installation-type == 'minimal'
run: |
pip install --no-deps -e .
pip install requests==2.32.4 openfeature-sdk==0.4.2 typing_extensions==4.9.0 httpx==0.27.2
pip install pytest==7.4.2 pytest-mock==3.11.1
- name: Test telemetry functionality
run: |
python -c "
from confidence.telemetry import Telemetry, PROTOBUF_AVAILABLE, ProtoTraceId, ProtoStatus
print(f'Installation: ${{ matrix.installation-type }}')
print(f'Protobuf available: {PROTOBUF_AVAILABLE}')
telemetry = Telemetry('test-version')
telemetry.add_trace(ProtoTraceId.PROTO_TRACE_ID_RESOLVE_LATENCY, 100, ProtoStatus.PROTO_STATUS_SUCCESS)
header = telemetry.get_monitoring_header()
if '${{ matrix.installation-type }}' == 'full':
assert PROTOBUF_AVAILABLE == True, 'Protobuf should be available in full installation'
assert len(header) > 0, 'Header should not be empty in full installation'
print('✅ Full installation: Telemetry enabled')
else:
assert PROTOBUF_AVAILABLE == False, 'Protobuf should not be available in minimal installation'
assert header == '', 'Header should be empty in minimal installation'
print('✅ Minimal installation: Telemetry disabled')
"
- name: Run core functionality tests
run: |
# Run a subset of tests to verify core functionality works in both scenarios
python -c "
from confidence.confidence import Confidence
from openfeature import api
from confidence.openfeature_provider import ConfidenceOpenFeatureProvider
# Test basic SDK initialization (should work in both scenarios)
confidence = Confidence('fake-token', disable_telemetry=True)
provider = ConfidenceOpenFeatureProvider(confidence)
print('✅ Core SDK functionality works')
"