Skip to content

Updating UT workflow file to run on every push #968

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

Merged
merged 6 commits into from
Feb 23, 2022
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/ci_e2e_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: CI E2E tests
on:
workflow_dispatch:
push:
branches: [ dev, master, main, release/* ]
branches: [ "*dev", master, main, release/* ]
pull_request:
branches: [ dev, master, main, release/* ]
branches: [ "*dev", master, main, release/* ]
schedule:
# Monday to Thursday 1 AM PDT build
# * is a special character in YAML so you have to quote this string
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ut_ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
name: CI Unit tests

on:
workflow_dispatch:
schedule:
# Monday to Thursday 1 AM PDT build
# * is a special character in YAML so you have to quote this string
- cron: "0 8 * * 1,2,3,4"
push:
branches: [ dev, master, main, release/* ]
pull_request:
branches: [ dev, master, main, release/* ]
branches: [ "*dev", master, main, release/* ]

jobs:
build:
Expand Down
37 changes: 17 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# <img src="https://github.com/raw/Azure/azure-functions-python-worker/dev/docs/Azure.Functions.svg" width = "30" alt="Functions Header Image - Lightning Logo"> Azure Functions Python Worker

|Branch|Status|CodeCov|Unittests|E2E tests|
|---|---|---|---|---|
|master|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=master)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=master)|[![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/master/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker)|![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=master)|![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=master)
|dev|[![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=dev)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=dev)|[![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker)|![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=dev)|![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=dev)
| Branch | Status | CodeCov | Unittests | E2E tests |
|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| main | [![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=main)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=main) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/main/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | ![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=main) | ![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=main) |
| dev | [![Build Status](https://azfunc.visualstudio.com/Azure%20Functions/_apis/build/status/Azure.azure-functions-python-worker?branchName=dev)](https://azfunc.visualstudio.com/Azure%20Functions/_build/latest?definitionId=57&branchName=dev) | [![codecov](https://codecov.io/gh/Azure/azure-functions-python-worker/branch/dev/graph/badge.svg)](https://codecov.io/gh/Azure/azure-functions-python-worker) | ![CI Unit tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20Unit%20tests/badge.svg?branch=dev) | ![CI E2E tests](https://github.com/Azure/azure-functions-python-worker/workflows/CI%20E2E%20tests/badge.svg?branch=dev) |

Python support for Azure Functions is based on Python 3.6, Python 3.7, and Python 3.8, serverless hosting on Linux and the Functions 2.0 and 3.0 runtime.

Here is the current status of Python in Azure Functions:

What are the supported Python versions?

|Azure Functions Runtime|Python 3.6|Python 3.7|Python 3.8|Python 3.9|
|---|---|---|---|---|
|Azure Functions 2.0|✔|✔|-|-|
|Azure Functions 3.0|✔|✔|✔|(preview)|
| Azure Functions Runtime | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 |
|-------------------------|------------|------------|------------|------------|
| Azure Functions 2.0 | ✔ | ✔ | - | - |
| Azure Functions 3.0 | ✔ | ✔ | ✔ | (preview) |

What's available?

Expand All @@ -23,9 +23,6 @@ What's available?
- Deploy Python Function project in a custom docker image onto dedicated, or elastic premium plan.
- Triggers / Bindings : HTTP, Blob, Queue, Timer, Cosmos DB, Event Grid, Event Hubs and Service Bus
- Triggers / Bindings : Custom binding support

What's coming?

- [Durable Functions For Python](https://github.com/Azure/azure-functions-durable-python)

# Get Started
Expand All @@ -40,15 +37,15 @@ What's coming?

Issues and feature requests are tracked in a variety of places. To report this feedback, please file an issue to the relevant repository below:

|Item|Description|Link|
|----|-----|-----|
| Python Worker | Programming Model, Triggers & Bindings |[File an Issue](https://github.com/Azure/azure-functions-python-worker/issues)|
| Linux | Base Docker Images |[File an Issue](https://github.com/Azure/azure-functions-docker/issues)|
| Runtime | Script Host & Language Extensibility |[File an Issue](https://github.com/Azure/azure-functions-host/issues)|
| VSCode | VSCode Extension for Azure Functions |[File an Issue](https://github.com/microsoft/vscode-azurefunctions/issues)
| Core Tools | Command Line Interface for Local Development |[File an Issue](https://github.com/Azure/azure-functions-core-tools/issues)|
| Portal | User Interface or Experience Issue |[File an Issue](https://github.com/azure/azure-functions-ux/issues)|
| Templates | Code Issues with Creation Template |[File an Issue](https://github.com/Azure/azure-functions-templates/issues)|
| Item | Description | Link |
|---------------|----------------------------------------------|--------------------------------------------------------------------------------|
| Python Worker | Programming Model, Triggers & Bindings | [File an Issue](https://github.com/Azure/azure-functions-python-worker/issues) |
| Linux | Base Docker Images | [File an Issue](https://github.com/Azure/azure-functions-docker/issues) |
| Runtime | Script Host & Language Extensibility | [File an Issue](https://github.com/Azure/azure-functions-host/issues) |
| VSCode | VSCode Extension for Azure Functions | [File an Issue](https://github.com/microsoft/vscode-azurefunctions/issues) |
| Core Tools | Command Line Interface for Local Development | [File an Issue](https://github.com/Azure/azure-functions-core-tools/issues) |
| Portal | User Interface or Experience Issue | [File an Issue](https://github.com/azure/azure-functions-ux/issues) |
| Templates | Code Issues with Creation Template | [File an Issue](https://github.com/Azure/azure-functions-templates/issues) |

# Contribute

Expand Down
121 changes: 69 additions & 52 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,64 @@
"""


CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
'Programming Language :: Python',
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Environment :: Web Environment",
"License :: OSI Approved :: MIT License",
"Intended Audience :: Developers",
]


PACKAGES = [
"azure_functions_worker",
"azure_functions_worker.protos",
"azure_functions_worker.protos.identity",
"azure_functions_worker.protos.shared",
"azure_functions_worker.bindings",
"azure_functions_worker.bindings.shared_memory_data_transfer",
"azure_functions_worker.utils",
"azure_functions_worker._thirdparty"
]


INSTALL_REQUIRES = [
"grpcio~=1.43.0",
"grpcio-tools~=1.43.0",
"protobuf~=3.19.3",
"azure-functions==1.9.0"
]


EXTRA_REQUIRES = {
"dev": [
"azure-eventhub~=5.7.0", # Used for EventHub E2E tests
"python-dateutil~=2.8.2",
"pycryptodome~=3.10.1",
"flake8~=4.0.1",
"mypy",
"pytest",
"requests==2.*",
"coverage",
"pytest-sugar",
"pytest-cov",
"pytest-xdist",
"pytest-randomly",
"pytest-instafail",
"pytest-rerunfailures",
"ptvsd"
]
}


class BuildGRPC:
"""Generate gRPC bindings."""
def _gen_grpc(self):
Expand Down Expand Up @@ -353,6 +411,12 @@ def run(self):
with open("README.md") as readme:
long_description = readme.read()

COMMAND_CLASS = {
'develop': develop,
'build': build,
'webhost': webhost,
'extension': extension
}

setup(
name='azure-functions-worker',
Expand All @@ -364,59 +428,12 @@ def run(self):
url="https://github.com/Azure/azure-functions-python-worker",
long_description=long_description,
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
'Environment :: Web Environment',
],
classifiers=CLASSIFIERS,
license='MIT',
packages=['azure_functions_worker',
'azure_functions_worker.protos',
'azure_functions_worker.protos.identity',
'azure_functions_worker.protos.shared',
'azure_functions_worker.bindings',
'azure_functions_worker.bindings.shared_memory_data_transfer',
'azure_functions_worker.utils',
'azure_functions_worker._thirdparty'],
install_requires=[
'grpcio~=1.33.2',
'grpcio-tools~=1.33.2',
],
extras_require={
'dev': [
'azure-functions==1.8.0',
'azure-eventhub~=5.1.0',
'python-dateutil~=2.8.1',
'pycryptodome~=3.10.1',
'flake8~=3.7.9',
'mypy',
'pytest',
'requests==2.*',
'coverage',
'pytest-sugar',
'pytest-cov',
'pytest-xdist',
'pytest-randomly',
'pytest-instafail',
'pytest-rerunfailures',
'ptvsd'
]
},
packages=PACKAGES,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRA_REQUIRES,
include_package_data=True,
cmdclass={
'develop': develop,
'build': build,
'webhost': webhost,
'extension': extension
},
cmdclass=COMMAND_CLASS,
test_suite='tests'
)
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def main(req: func.HttpRequest):
with client:
client.send_batch(event_data_batch)

return f'OK'
return 'OK'
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ async def main(req: func.HttpRequest):
finally:
await client.close()

return f'OK'
return 'OK'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

__version__: str == 'function_app'
__version__: str = 'function_app'

import os
# This module should be shadowed from customer_deps_path/common_module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

__version__: str == 'function_app'
__version__: str = 'function_app'

import os
# ./tests/unittests/resources/customer_func_path/func_specific_module
Expand Down
8 changes: 4 additions & 4 deletions tests/unittests/test_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ async def test_dispatcher_initialize_worker_logging(self):
async with self._ctrl as host:
r = await host.init_worker('3.0.12345')
self.assertEqual(
len([l for l in r.logs if l.message.startswith(
len([log for log in r.logs if log.message.startswith(
'Received WorkerInitRequest'
)]),
1
)

self.assertEqual(
len([l for l in r.logs if l.message.startswith(
len([log for log in r.logs if log.message.startswith(
'To enable debug level logging'
)]),
1
Expand All @@ -86,14 +86,14 @@ async def test_dispatcher_environment_reload_logging(self):
# Reload environment variable on specialization
r = await host.reload_environment(environment={})
self.assertEqual(
len([l for l in r.logs if l.message.startswith(
len([log for log in r.logs if log.message.startswith(
'Received FunctionEnvironmentReloadRequest'
)]),
1
)

self.assertEqual(
len([l for l in r.logs if l.message.startswith(
len([log for log in r.logs if log.message.startswith(
'To enable debug level logging'
)]),
1
Expand Down