Skip to content

Commit b871df8

Browse files
authored
Improve local CI validation (#215)
* Improve local CI validation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Set up Python for Azure Managed tests Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Support focused reusable test sessions Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Support Noxfile annotations on Python 3.10 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Clarify focused validation arguments Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Clarify representative CI validation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Use minimum Python for CI baseline Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Harden Azurite startup handling Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Harden Nox aggregate validation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce * Clarify validation prerequisites Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce --------- Copilot-Session: 61acbc5e-7c07-42a7-8e38-31329c4befce
1 parent 4bc616c commit b871df8

6 files changed

Lines changed: 465 additions & 182 deletions

File tree

.github/workflows/durabletask-azurefunctions.yml

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,11 @@ jobs:
2323
with:
2424
python-version: 3.13
2525
- name: Install dependencies
26-
working-directory: azure-functions-durable
2726
run: |
2827
python -m pip install --upgrade pip
29-
pip install setuptools wheel tox
30-
pip install flake8
31-
- name: Run flake8 Linter
32-
working-directory: azure-functions-durable
33-
run: flake8 .
34-
- name: Run flake8 Linter
35-
working-directory: tests/azure-functions-durable
36-
run: flake8 .
28+
pip install nox
29+
- name: Run lint checks
30+
run: nox -s lint
3731

3832
run-tests:
3933
strategy:
@@ -51,35 +45,13 @@ jobs:
5145
with:
5246
python-version: ${{ matrix.python-version }}
5347

54-
- name: Install durabletask dependencies
48+
- name: Install Nox
5549
run: |
5650
python -m pip install --upgrade pip
57-
pip install flake8 pytest
58-
pip install -r requirements.txt
59-
60-
- name: Install durabletask locally
61-
run: |
62-
pip install . --no-deps --force-reinstall
63-
64-
- name: Install azure-functions-durable locally
65-
working-directory: azure-functions-durable
66-
run: |
67-
pip install . --no-deps --force-reinstall
68-
69-
# ``requirements.txt`` (shared with the core 3.10-3.14 CI) leaves
70-
# azure-functions unpinned so it can resolve on Python < 3.13. The
71-
# provider needs azure-functions>=2.3.0b2 (which requires 3.13+ and
72-
# provides ``register_converter``); the local installs above use
73-
# ``--no-deps``, so install that floor explicitly here. This job only runs
74-
# on 3.13/3.14, where 2.3.0b2 is available.
75-
- name: Install azure-functions (>=2.3.0b2)
76-
run: |
77-
pip install "azure-functions>=2.3.0b2"
51+
pip install nox
7852
7953
- name: Run unit tests
80-
working-directory: tests/azure-functions-durable
81-
run: |
82-
pytest -m "not dts and not azurite and not functions_e2e" --verbose
54+
run: nox -s functions_unit-${{ matrix.python-version }}
8355

8456
e2e-tests:
8557
needs: run-tests
@@ -115,17 +87,6 @@ jobs:
11587
npm install -g azurite@latest
11688
npm install -g azure-functions-core-tools@4 --unsafe-perm true
11789
118-
- name: Start Azurite
119-
shell: bash
120-
# The DurableTask.AzureStorage provider in recent extension bundles uses
121-
# a newer Azure Storage REST API version than the CI Azurite build
122-
# recognizes, which otherwise fails task-hub creation with "The API
123-
# version ... is not supported by Azurite". ``--skipApiVersionCheck``
124-
# bypasses that guard so the durable provider can talk to Azurite.
125-
run: |
126-
azurite --silent --skipApiVersionCheck --location /tmp/azurite --blobPort 10000 --queuePort 10001 --tablePort 10002 &
127-
sleep 2
128-
12990
- name: Install nox
13091
run: |
13192
python -m pip install --upgrade pip
@@ -151,4 +112,3 @@ jobs:
151112
path: tests/azure-functions-durable/e2e/apps/*/_func_host.log
152113
if-no-files-found: warn
153114
retention-days: 7
154-

.github/workflows/durabletask-azuremanaged.yml

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,68 +23,32 @@ jobs:
2323
with:
2424
python-version: 3.14
2525
- name: Install dependencies
26-
working-directory: durabletask-azuremanaged
2726
run: |
2827
python -m pip install --upgrade pip
29-
pip install setuptools wheel tox
30-
pip install flake8
31-
- name: Run flake8 Linter
32-
working-directory: durabletask-azuremanaged
33-
run: flake8 .
34-
- name: Run flake8 Linter
35-
working-directory: tests/durabletask-azuremanaged
36-
run: flake8 .
28+
pip install nox
29+
- name: Run lint checks
30+
run: nox -s lint
3731

3832
run-docker-tests:
3933
strategy:
4034
fail-fast: false
4135
matrix:
4236
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
43-
env:
44-
EMULATOR_VERSION: "latest"
4537
needs: lint
4638
runs-on: ubuntu-latest
4739
steps:
4840
- name: Checkout repository
4941
uses: actions/checkout@v4
5042

51-
- name: Pull Docker image
52-
run: docker pull mcr.microsoft.com/dts/dts-emulator:$EMULATOR_VERSION
43+
- name: Set up Python ${{ matrix.python-version }}
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: ${{ matrix.python-version }}
5347

54-
- name: Run Docker container
55-
run: |
56-
docker run --name dtsemulator -d -p 8080:8080 mcr.microsoft.com/dts/dts-emulator:$EMULATOR_VERSION
57-
58-
- name: Wait for container to be ready
59-
run: sleep 10 # Adjust if your service needs more time to start
60-
61-
- name: Set environment variables
62-
run: |
63-
echo "TASKHUB=default" >> $GITHUB_ENV
64-
echo "ENDPOINT=http://localhost:8080" >> $GITHUB_ENV
65-
66-
- name: Install durabletask dependencies
48+
- name: Install Nox
6749
run: |
6850
python -m pip install --upgrade pip
69-
pip install flake8 pytest
70-
pip install -r requirements.txt
71-
72-
- name: Install durabletask-azuremanaged dependencies
73-
working-directory: examples
74-
run: |
75-
python -m pip install --upgrade pip
76-
pip install -r requirements.txt
77-
78-
- name: Install durabletask-azuremanaged locally
79-
working-directory: durabletask-azuremanaged
80-
run: |
81-
pip install . --no-deps --force-reinstall
82-
83-
- name: Install durabletask locally
84-
run: |
85-
pip install . --no-deps --force-reinstall
51+
pip install nox
8652
8753
- name: Run the tests
88-
working-directory: tests/durabletask-azuremanaged
89-
run: |
90-
pytest -m "dts" --verbose
54+
run: nox -s azuremanaged_tests-${{ matrix.python-version }}

.github/workflows/durabletask.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,9 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install setuptools wheel tox
29-
pip install flake8
30-
- name: Run flake8 Linter
31-
working-directory: durabletask
32-
run: flake8 .
33-
- name: "Run flake8 linter: tests"
34-
working-directory: tests/durabletask
35-
run: flake8 .
36-
- name: "Run flake8 linter: examples"
37-
working-directory: examples
38-
run: flake8 .
28+
pip install nox
29+
- name: Run lint checks
30+
run: nox -s lint
3931

4032
run-tests:
4133
strategy:
@@ -67,21 +59,10 @@ jobs:
6759
- name: Install Azurite
6860
run: npm install -g azurite
6961

70-
- name: Start Azurite
71-
shell: bash
72-
run: |
73-
azurite-blob --silent --blobPort 10000 &
74-
sleep 2
75-
76-
- name: Install durabletask dependencies and the library itself
62+
- name: Install Nox
7763
run: |
7864
python -m pip install --upgrade pip
79-
pip install flake8 pytest
80-
pip install -r requirements.txt
81-
pip install ".[azure-blob-payloads]"
82-
pip install aiohttp
65+
pip install nox
8366
8467
- name: Pytest unit tests
85-
working-directory: tests/durabletask
86-
run: |
87-
pytest -m "not dts" --verbose
68+
run: nox -s core_tests-${{ matrix.python-version }}

.github/workflows/typecheck.yml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,10 @@ jobs:
3030
- name: Install packages and dependencies
3131
run: |
3232
python -m pip install --upgrade pip
33-
pip install -r requirements.txt
34-
# Install third-party dependencies declared by the examples so they
35-
# type-check cleanly. Each example's requirements.txt is the single
36-
# source of truth for its dependencies.
37-
for req in examples/requirements.txt examples/*/requirements.txt; do
38-
pip install -r "$req"
39-
done
40-
# Install the packages under test from local source last (non-editable
41-
# so the durabletask / durabletask.azuremanaged namespace packages are
42-
# physically merged in site-packages, which pyright can resolve). This
43-
# overrides any PyPI copy pulled in by the example requirements above.
44-
pip install --force-reinstall --no-deps . ./durabletask-azuremanaged
45-
pip install ".[azure-blob-payloads,opentelemetry]"
46-
pip install pyright
33+
pip install nox
4734
4835
- name: Run pyright (strict, Python 3.10)
49-
run: pyright
36+
run: nox -s typecheck_core
5037

5138
pyright-azurefunctions:
5239
runs-on: ubuntu-latest
@@ -62,10 +49,7 @@ jobs:
6249
- name: Install packages and dependencies
6350
run: |
6451
python -m pip install --upgrade pip
65-
pip install -r requirements.txt
66-
pip install -e ".[azure-blob-payloads,opentelemetry]"
67-
pip install -e ./azure-functions-durable
68-
pip install pyright
52+
pip install nox
6953
7054
- name: Run pyright (strict, Python 3.13)
71-
run: pyright -p azure-functions-durable/pyrightconfig.json
55+
run: nox -s typecheck_functions

docs/development.md

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,72 @@
11
# Development
22

3-
The following is more information about how to develop this project. Note that development commands
4-
require that `make` is installed on your local machine. If you're using Windows, you can install
5-
`make` using [Chocolatey](https://chocolatey.org/) or use WSL.
3+
The following is more information about how to develop this project.
4+
5+
## Validation
6+
7+
Use Nox to run the representative local correctness checks:
8+
9+
```sh
10+
python -m pip install -r dev-requirements.txt
11+
nox -s ci
12+
```
13+
14+
The `ci` session runs linting, strict type checks, core SDK and Azure Managed
15+
tests on Python 3.10, Azure Functions unit tests on Python 3.13, and Azure
16+
Functions end-to-end tests on Python 3.13. It intentionally runs one
17+
representative version rather than the complete CI matrix, keeping routine
18+
local validation fast. To use another supported version (3.10--3.14) for the
19+
core SDK and Azure Managed tests, pass it after `--`:
20+
21+
```sh
22+
nox -s ci -- 3.14
23+
```
24+
25+
Run the versioned test sessions directly when a change needs complete matrix
26+
coverage, for example `nox -s core_tests` or `nox -s azuremanaged_tests`.
27+
Nox fails rather than silently skipping a session when its required Python
28+
interpreter is unavailable.
29+
30+
Nox starts Azurite automatically for the core and Azure Functions tests. The
31+
Azure Managed tests start a disposable DTS emulator Docker container. Start
32+
Docker before running that session. Azure Functions end-to-end tests also
33+
require the Azure Functions Core Tools (`func`) on `PATH`. Azure Managed Nox
34+
runs use a disposable DTS emulator with an automatically assigned port, and
35+
Functions E2E uses a unique Durable Functions hub. Both can run alongside other
36+
local validation sessions.
37+
38+
CodeQL remains a GitHub-hosted security scan; it requires the CodeQL CLI and
39+
its query packs, so it is not included in the local `ci` session.
40+
41+
For iterative validation, use `-R` to reuse the session virtual environment.
42+
The local packages are editable in test sessions, so source changes are picked
43+
up without reinstalling. Pass file or directory paths after `--` to lint and
44+
type-check sessions. Pytest-based sessions also accept test node IDs and pytest
45+
selectors such as `-k`. Nox forwards these arguments unchanged to the
46+
underlying tool, and multiple paths or selectors are supported.
47+
48+
For a focused change, run just the relevant session:
49+
50+
```sh
51+
nox -R -s lint -- durabletask/client.py tests/durabletask/test_client.py
52+
nox -R -s typecheck_core -- durabletask/client.py durabletask/extensions/history_export
53+
nox -R -s typecheck_functions -- azure-functions-durable/azure
54+
nox -R -s core_tests-3.10 -- tests/durabletask/test_client.py::test_get_grpc_channel_insecure
55+
nox -R -s azuremanaged_tests-3.10 -- tests/durabletask-azuremanaged/test_dts_orchestration_e2e.py
56+
nox -R -s functions_unit-3.13 -- tests/azure-functions-durable/test_client_compat.py
57+
nox -R -s functions_e2e -- -k "dtask_client"
58+
```
59+
60+
> [!NOTE]
61+
> The Azure Managed session still starts a fresh isolated DTS emulator for every
62+
> run, and Functions E2E starts a fresh Functions host. `-R` skips environment
63+
> provisioning, not these required runtime services.
664
765
## Generating protobufs
866

67+
These commands require `make`. If you're using Windows, you can install `make`
68+
using [Chocolatey](https://chocolatey.org/) or use WSL.
69+
970
```sh
1071
pip3 install -r dev-requirements.txt
1172
make gen-proto
@@ -14,11 +75,3 @@ make gen-proto
1475
This will download the `orchestrator_service.proto` from the `microsoft/durabletask-protobuf` repo
1576
and compile it using `grpcio-tools`. The version of the source proto file that was downloaded can be
1677
found in the file `durabletask/internal/PROTO_SOURCE_COMMIT_HASH`.
17-
18-
### Running tests
19-
20-
Tests can be run using the following command from the project root.
21-
22-
```sh
23-
make test
24-
```

0 commit comments

Comments
 (0)