diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml new file mode 100644 index 00000000..64e6376d --- /dev/null +++ b/.github/workflows/lint-pr.yml @@ -0,0 +1,22 @@ +# 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 PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + main: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/merge.yml similarity index 65% rename from .github/workflows/test.yml rename to .github/workflows/merge.yml index f4253866..1e03ad5d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/merge.yml @@ -3,12 +3,11 @@ # separate terms of service, privacy policy, and support # documentation. -name: Test +name: Merge on: push: - branches-ignore: - - 'main' + branches: [ master, main ] jobs: build: @@ -37,6 +36,11 @@ jobs: [ ! -d ".venv" ] && virtualenv .venv . .venv/bin/activate + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: python + - name: Install dependencies run: pip install -r requirements-dev.txt @@ -50,4 +54,15 @@ jobs: run: isort . - name: Test with pytest - run: pytest \ No newline at end of file + run: coverage run --omit="*/test*" -m pytest + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@e0fbd592d323cb2991fb586fdd260734fcb41fcb + with: + flags: unittests # optional + name: coverage # optional + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 \ No newline at end of file diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml new file mode 100644 index 00000000..ee03562d --- /dev/null +++ b/.github/workflows/pullrequest.yml @@ -0,0 +1,71 @@ +# 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: PR + +on: + pull_request: + branches: [ master, main ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + container: [ "python:3.8", "python:3.9", "python:3.10" ] + container: + image: ${{ matrix.container }} + + steps: + - uses: actions/checkout@v2 + + - name: Cache virtualenvironment + uses: actions/cache@v2 + with: + path: ~/.venv + key: ${{ hashFiles('requirements.txt', 'requirements-dev.txt') }} + + - 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: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: python + + - name: Install dependencies + run: pip install -r requirements-dev.txt + + - name: Run black formatter check + run: black --check . + + - name: Run flake8 formatter check + run: flake8 . + + - name: Run isort formatter check + run: isort . + + - name: Test with pytest + run: coverage run --omit="*/test*" -m pytest + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@e0fbd592d323cb2991fb586fdd260734fcb41fcb + with: + flags: unittests # optional + name: coverage # optional + fail_ci_if_error: true # optional (default = false) + verbose: true # optional (default = false) + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 \ No newline at end of file diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/release.yml similarity index 80% rename from .github/workflows/build-and-deploy.yml rename to .github/workflows/release.yml index c4f0ad90..8d6c4589 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/release.yml @@ -3,12 +3,15 @@ # separate terms of service, privacy policy, and support # documentation. -name: Build and Deploy +name: Release on: push: branches: - - 'main' + - main + +permissions: # added using https://github.com/step-security/secure-workflows + contents: read jobs: build: @@ -38,19 +41,7 @@ jobs: . .venv/bin/activate - name: Install dependencies - run: pip install -r requirements-dev.txt - - - name: Run black formatter check - run: black --check . - - - name: Run flake8 formatter check - run: flake8 . - - - name: Run isort formatter check - run: isort . - - - name: Test with pytest - run: pytest + run: pip install -r requirements.txt - name: Install pypa/build run: >- diff --git a/pyproject.toml b/pyproject.toml index bbdf61e4..f4a4734b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,11 +4,11 @@ requires = ["setuptools>=61.0.0", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "python_open_feature_sdk" +name = "openfeature_sdk" version = "0.0.1" description = "Standardizing Feature Flagging for Everyone" -readme = "README.md" -authors = [{ name = "Open Feature", email = "opensource@dynatrace.com" }] +readme = "readme.md" +authors = [{ name = "OpenFeature", email = "openfeature-core@groups.io" }] license = { file = "LICENSE" } classifiers = [ "License :: OSI Approved :: Apache Software License", diff --git a/readme.md b/readme.md index 3c8f3108..44dbe38a 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,9 @@ # Open Feature SDK for Python +[![PyPI version](https://badge.fury.io/py/openfeature-sdk.svg)](https://badge.fury.io/py/openfeature-sdk) [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) +[![Specification](https://img.shields.io/static/v1?label=Specification&message=v0.3.0&color=red)](https://github.com/open-feature/spec/tree/v0.3.0) +[![on-merge](https://github.com/open-feature/python-sdk/actions/workflows/merge.yml/badge.svg)](https://github.com/open-feature/python-sdk/actions/workflows/merge.yml) +[![codecov](https://codecov.io/gh/open-feature/python-sdk/branch/main/graph/badge.svg?token=FQ1I444HB3)](https://codecov.io/gh/open-feature/python-sdk) This is the Python implementation of [OpenFeature](https://openfeature.dev), a vendor-agnostic abstraction library for evaluating feature flags. diff --git a/requirements-dev.in b/requirements-dev.in index 84463ebd..917bafc9 100644 --- a/requirements-dev.in +++ b/requirements-dev.in @@ -5,4 +5,5 @@ black pip-tools pre-commit flake8 -pytest-mock \ No newline at end of file +pytest-mock +coverage \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 9a10979d..0a5a2ab9 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,20 +8,16 @@ astroid==2.11.5 # via pylint attrs==21.4.0 # via pytest -autopep8==1.6.0 - # via -r requirements-dev.in black==22.3.0 # via -r requirements-dev.in -certifi==2021.10.8 - # via requests cfgv==3.3.1 # via pre-commit -charset-normalizer==2.0.12 - # via requests click==8.1.3 # via # black # pip-tools +coverage==6.5.0 + # via -r requirements-dev.in dill==0.3.4 # via pylint distlib==0.3.4 @@ -32,8 +28,6 @@ flake8==4.0.1 # via -r requirements-dev.in identify==2.5.0 # via pre-commit -idna==3.3 - # via requests iniconfig==1.1.1 # via pytest isort==5.10.1 @@ -54,8 +48,6 @@ pathspec==0.9.0 # via black pep517==0.12.0 # via pip-tools -pep8==1.7.1 - # via -r requirements-dev.in pip-tools==6.6.0 # via -r requirements-dev.in platformdirs==2.5.2 @@ -70,9 +62,7 @@ pre-commit==2.19.0 py==1.11.0 # via pytest pycodestyle==2.8.0 - # via - # autopep8 - # flake8 + # via flake8 pyflakes==2.4.0 # via flake8 pylint==2.13.8 @@ -87,16 +77,10 @@ pytest-mock==3.7.0 # via -r requirements-dev.in pyyaml==6.0 # via pre-commit -requests==2.27.1 - # via responses -responses==0.20.0 - # via -r requirements-dev.in six==1.16.0 # via virtualenv toml==0.10.2 - # via - # autopep8 - # pre-commit + # via pre-commit tomli==2.0.1 # via # black @@ -108,10 +92,6 @@ typing-extensions==4.2.0 # astroid # black # pylint -urllib3==1.26.9 - # via - # requests - # responses virtualenv==20.14.1 # via pre-commit wheel==0.37.1 diff --git a/requirements.txt b/requirements.txt index e69de29b..cf3204d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,6 @@ +# +# This file is autogenerated by pip-compile with python 3.10 +# To update, run: +# +# pip-compile requirements.in +#