From 45e7637510f12d39171723abaa592f061df6f2b9 Mon Sep 17 00:00:00 2001 From: Chris Gillum Date: Thu, 13 Apr 2023 21:55:51 -0700 Subject: [PATCH 1/3] Setup PR validator with GitHub actions --- .github/workflows/pr-validation.yml | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/pr-validation.yml diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 0000000..5d7125d --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + pip install -r requirements.txt + - name: Lint with flake8 + run: | + # flake8 settings are in setup.cfg + flake8 . --count --show-source --statistics --exit-zero + - name: Test with pytest + run: | + # pytest markers are defined in setup.cfg + pytest -m "not e2e" --verbose From ce7c3ee5c7b5beb3224ea4b0f5c0a9b68b86c383 Mon Sep 17 00:00:00 2001 From: Chris Gillum Date: Fri, 14 Apr 2023 05:15:04 +0000 Subject: [PATCH 2/3] Reduce supported Python versions --- .github/workflows/pr-validation.yml | 4 ++-- README.md | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 5d7125d..4a9d0c0 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python package +name: PR Validation on: push: @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.10", "3.11"] steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index c9899d5..8cc5fe2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repo contains a Python client SDK for use with the [Durable Task Framework ### Prerequisites -- Python 3.8 or higher +- Python 3.10 or higher ### Installing @@ -32,13 +32,24 @@ If the gRPC proto definitions need to be updated, the corresponding source code python3 -m grpc_tools.protoc --proto_path=./submodules/durabletask-protobuf/protos --python_out=./durabletask/protos --pyi_out=./durabletask/protos --grpc_python_out=./durabletask/protos orchestrator_service.proto ``` +### Linting and running unit tests + +See the [pr-validation.yml](.github/workflows/pr-validation.yml) workflow for the full list of commands that are run as part of the CI/CD pipeline. + ### Running E2E tests + The E2E (end-to-end) tests require a sidecar process to be running. You can run a sidecar process using the following `docker` command (assumes you have Docker installed on your local system.) ```sh docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' --rm cgillum/durabletask-sidecar:latest start --backend Emulator ``` +To run the E2E tests, run the following command from the project root (we assume you have `pytest` installed locally): + +```sh +pytest -m e2e --verbose +``` + ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a From 0d34b91dce8f346c3ecb356e94b059c2aa34f508 Mon Sep 17 00:00:00 2001 From: Chris Gillum Date: Fri, 14 Apr 2023 05:21:20 +0000 Subject: [PATCH 3/3] Rename workflow --- .github/workflows/pr-validation.yml | 2 +- README.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 4a9d0c0..8181ea8 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: PR Validation +name: Build Validation on: push: diff --git a/README.md b/README.md index 8cc5fe2..c22b2d5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Durable Task Client SDK for Python [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) +[![Build Validation](https://github.com/microsoft/durabletask-python/actions/workflows/pr-validation.yml/badge.svg)](https://github.com/microsoft/durabletask-python/actions/workflows/pr-validation.yml) This repo contains a Python client SDK for use with the [Durable Task Framework for Go](https://github.com/microsoft/durabletask-go) and [Dapr Workflow](https://docs.dapr.io/developing-applications/building-blocks/workflow/workflow-overview/). With this SDK, you can define, schedule, and manage durable orchestrations using ordinary Python code.