Skip to content

Commit f30442e

Browse files
authored
Update GitHub workflows and automate release (microsoft#51)
* Update GitHub workflows and automate release * Update linter config * more workflow changes * linter fixes * ignore new linter warning * even more workflow cleanup and improvement * declare asyncio as package dependency * Update requirements.txt
1 parent 6a2ab15 commit f30442e

File tree

9 files changed

+163
-104
lines changed

9 files changed

+163
-104
lines changed

.github/workflows/publish-dts-sdk.yml renamed to .github/workflows/durabletask-azuremanaged.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Durable Task Scheduler to PyPI
1+
name: Durable Task Scheduler SDK (durabletask-azuremanaged)
22

33
on:
44
push:
@@ -15,10 +15,10 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- uses: actions/checkout@v4
18-
- name: Set up Python 3.12
18+
- name: Set up Python 3.13
1919
uses: actions/setup-python@v5
2020
with:
21-
python-version: 3.12
21+
python-version: 3.13
2222
- name: Install dependencies
2323
working-directory: durabletask-azuremanaged
2424
run: |
@@ -28,10 +28,17 @@ jobs:
2828
- name: Run flake8 Linter
2929
working-directory: durabletask-azuremanaged
3030
run: flake8 .
31+
- name: Run flake8 Linter
32+
working-directory: tests/durabletask-azuremanaged
33+
run: flake8 .
3134

3235
run-docker-tests:
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3340
env:
34-
EMULATOR_VERSION: "v0.0.5" # Define the variable
41+
EMULATOR_VERSION: "latest"
3542
needs: lint
3643
runs-on: ubuntu-latest
3744
steps:
@@ -84,7 +91,7 @@ jobs:
8491
- name: Set up Python
8592
uses: actions/setup-python@v5
8693
with:
87-
python-version: "3.12" # Adjust Python version as needed
94+
python-version: "3.13" # Adjust Python version as needed
8895

8996
- name: Install dependencies
9097
run: |

.github/workflows/durabletask.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Durable Task SDK (durabletask)
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
tags:
8+
- "v*" # Only run for tags starting with "v"
9+
pull_request:
10+
branches:
11+
- "main"
12+
13+
jobs:
14+
lint-and-unit-tests:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python 3.13
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: 3.13
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install setuptools wheel tox
26+
pip install flake8
27+
- name: Run flake8 Linter
28+
working-directory: durabletask
29+
run: flake8 .
30+
- name: "Run flake8 linter: tests"
31+
working-directory: tests/durabletask
32+
run: flake8 .
33+
- name: "Run flake8 linter: examples"
34+
working-directory: examples
35+
run: flake8 .
36+
37+
run-tests:
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
42+
needs: lint-and-unit-tests
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
- name: Set up Python ${{ matrix.python-version }}
48+
uses: actions/setup-python@v5
49+
with:
50+
python-version: ${{ matrix.python-version }}
51+
- name: Install durabletask dependencies and the library itself
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install flake8 pytest
55+
pip install -r requirements.txt
56+
pip install .
57+
- name: Pytest unit tests
58+
working-directory: tests/durabletask
59+
run: |
60+
pytest -m "not e2e and not dts" --verbose
61+
# Sidecar for running e2e tests requires Go SDK
62+
- name: Install Go SDK
63+
uses: actions/setup-go@v5
64+
with:
65+
go-version: 'stable'
66+
# Install and run the durabletask-go sidecar for running e2e tests
67+
- name: Pytest e2e tests
68+
working-directory: tests/durabletask
69+
run: |
70+
go install github.com/microsoft/durabletask-go@main
71+
durabletask-go --port 4001 &
72+
pytest -m "e2e and not dts" --verbose
73+
74+
publish:
75+
if: startsWith(github.ref, 'refs/tags/v') # Only run if a matching tag is pushed
76+
needs: run-tests
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Extract version from tag
83+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV # Extract version from the tag
84+
85+
- name: Set up Python
86+
uses: actions/setup-python@v5
87+
with:
88+
python-version: "3.13" # Adjust Python version as needed
89+
90+
- name: Install dependencies
91+
run: |
92+
python -m pip install --upgrade pip
93+
pip install build twine
94+
95+
- name: Build package from root directory
96+
run: |
97+
python -m build
98+
99+
- name: Check package
100+
run: |
101+
twine check dist/*
102+
103+
- name: Publish package to PyPI
104+
env:
105+
TWINE_USERNAME: __token__
106+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} # Store your PyPI API token in GitHub Secrets
107+
run: |
108+
twine upload dist/*

.github/workflows/pr-validation.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ license = {file = "LICENSE"}
2626
readme = "README.md"
2727
dependencies = [
2828
"grpcio",
29-
"protobuf"
29+
"protobuf",
30+
"asyncio"
3031
]
3132

3233
[project.urls]

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ grpcio>=1.60.0 # 1.60.0 is the version introducing protobuf 1.25.X support, newe
33
protobuf
44
pytest
55
pytest-cov
6-
azure-core
7-
azure-identity
6+
azure-identity
7+
asyncio

tests/durabletask-azuremanaged/test_dts_activity_sequence.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
that calls an activity function in a sequence and prints the outputs."""
33
import os
44

5+
import pytest
6+
57
from durabletask import client, task
68
from durabletask.azuremanaged.client import DurableTaskSchedulerClient
79
from durabletask.azuremanaged.worker import DurableTaskSchedulerWorker
810

9-
import pytest
10-
11-
1211
pytestmark = pytest.mark.dts
1312

13+
1414
def hello(ctx: task.ActivityContext, name: str) -> str:
1515
"""Activity function that returns a greeting"""
1616
return f'Hello {name}!'

0 commit comments

Comments
 (0)