-
Notifications
You must be signed in to change notification settings - Fork 907
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
955 additions
and
247 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
.github/pipelines/promptflow-csharp-e2e-test-env-setup.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
parameters: | ||
- name: promptflowCsPat | ||
displayName: "PAT to clone csharp repository" | ||
type: string | ||
- name: flowProjectRelativePath | ||
displayName: "Flow Project Relative Path" | ||
type: string | ||
|
||
steps: | ||
- task: UseDotNet@2 | ||
inputs: | ||
version: '6.x' | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: '3.9.x' | ||
architecture: 'x64' | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Install promptflow cli' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
Set-PSDebug -Trace 1 | ||
pip install -r src/promptflow/dev_requirements.txt | ||
pip install src/promptflow-tracing | ||
pip install src/promptflow-core[executor-service] | ||
pip install src/promptflow-devkit | ||
pip install src/promptflow-azure | ||
pip install src/promptflow-recording | ||
pip freeze | ||
- task: PowerShell@2 | ||
displayName: 'Clone csharp repository' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
git clone https://$(PROMPTFLOW_CS_PAT)@dev.azure.com/msdata/Vienna/_git/PromptflowCS csharp | ||
- task: NuGetAuthenticate@1 | ||
|
||
- task: DotNetCoreCLI@2 | ||
inputs: | ||
command: 'restore' | ||
projects: '$(flowProjectRelativePath)/**/*.csproj' | ||
feedsToUse: 'config' | ||
nugetConfigPath: '$(flowProjectRelativePath)/nuget.config' | ||
displayName: 'dotnet restore' | ||
|
||
- task: DotNetCoreCLI@2 | ||
inputs: | ||
command: 'build' | ||
projects: '$(flowProjectRelativePath)/**/*.csproj' | ||
feedsToUse: 'config' | ||
nugetConfigPath: '$(flowProjectRelativePath)/nuget.config' | ||
displayName: 'dotnet build' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
parameters: | ||
- name: azureOpenAiApiKey | ||
displayName: "Azure OpenAI API Key" | ||
type: string | ||
- name: azureOpenAiApiBase | ||
displayName: "Azure OpenAI API Base" | ||
type: string | ||
- name: flowProjectRelativePath | ||
displayName: "Flow Project Relative Path" | ||
type: string | ||
|
||
steps: | ||
- task: PowerShell@2 | ||
displayName: 'Run sdk cli tests' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
cd ./src/promptflow-devkit | ||
pytest tests/ -m "csharp" | ||
env: | ||
CSHARP_TEST_PROJECTS_ROOT: $(Build.SourcesDirectory)/$(flowProjectRelativePath) | ||
AZURE_OPENAI_API_KEY: $(azureOpenAiApiKey) | ||
AZURE_OPENAI_ENDPOINT: $(azureOpenAiApiBase) | ||
IS_IN_CI_PIPELINE: true | ||
|
||
- task: PowerShell@2 | ||
displayName: 'Run azure sdk cli tests' | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
cd ./src/promptflow-azure | ||
poetry run pytest tests/ -m "csharp" | ||
env: | ||
CSHARP_TEST_PROJECTS_ROOT: $(Build.SourcesDirectory)/$(flowProjectRelativePath) | ||
AZURE_OPENAI_API_KEY: $(azureOpenAiApiKey) | ||
AZURE_OPENAI_ENDPOINT: $(azureOpenAiApiBase) | ||
PROMPT_FLOW_TEST_MODE: "replay" | ||
IS_IN_CI_PIPELINE: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
src/promptflow-azure/tests/sdk_cli_azure_test/e2etests/test_csharp_cli.py
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
src/promptflow-azure/tests/sdk_cli_azure_test/e2etests/test_csharp_sdk.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# --------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# --------------------------------------------------------- | ||
|
||
from typing import Callable | ||
|
||
import pytest | ||
|
||
from promptflow._sdk.entities import Run | ||
from promptflow.azure import PFClient | ||
|
||
from .._azure_utils import DEFAULT_TEST_TIMEOUT, PYTEST_TIMEOUT_METHOD | ||
|
||
|
||
@pytest.mark.timeout(timeout=DEFAULT_TEST_TIMEOUT, method=PYTEST_TIMEOUT_METHOD) | ||
@pytest.mark.e2etest | ||
@pytest.mark.csharp | ||
@pytest.mark.usefixtures( | ||
"mock_set_headers_with_user_aml_token", | ||
"single_worker_thread_pool", | ||
"vcr_recording", | ||
) | ||
class TestCSharpSdk: | ||
def test_basic_run_bulk(self, pf: PFClient, randstr: Callable[[str], str], csharp_test_project_basic): | ||
name = randstr("name") | ||
|
||
run = pf.run( | ||
flow=csharp_test_project_basic["flow_dir"], | ||
data=csharp_test_project_basic["data"], | ||
name=name, | ||
) | ||
assert isinstance(run, Run) | ||
assert run.name == name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.