Skip to content
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

[Fundamental] Move devkit and azure tests #2707

Merged
merged 66 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
b967fad
Draft
crazygao Apr 1, 2024
885a413
comment
crazygao Apr 1, 2024
bf94caa
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 2, 2024
51be8f6
Fix
crazygao Apr 2, 2024
dbedcd3
Fix
crazygao Apr 3, 2024
a3fb403
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 8, 2024
108a956
Fix
crazygao Apr 8, 2024
3a46a9f
Fix
crazygao Apr 8, 2024
75d7eef
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 9, 2024
d1e7819
Fix
crazygao Apr 9, 2024
a63826a
Fix
crazygao Apr 9, 2024
3901d95
Fix
crazygao Apr 9, 2024
53f1dcd
Fix
crazygao Apr 9, 2024
27e76ef
Fix
crazygao Apr 9, 2024
516e6f0
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 9, 2024
ae19a10
Fix
crazygao Apr 9, 2024
466b0af
Fix
crazygao Apr 9, 2024
e274709
Fix
crazygao Apr 9, 2024
d24d219
Fix
crazygao Apr 9, 2024
4857593
Fix
crazygao Apr 9, 2024
c22458c
Fix
crazygao Apr 9, 2024
cd944e0
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 9, 2024
1c5d275
Fix
crazygao Apr 9, 2024
27776db
Fix
crazygao Apr 9, 2024
67f48f6
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 9, 2024
ebdb30b
Fix
crazygao Apr 10, 2024
7c89abd
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 10, 2024
38c8908
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 10, 2024
b7f5f7e
Fix
crazygao Apr 10, 2024
a70b05f
Fix
crazygao Apr 10, 2024
9f12a5f
Fix
crazygao Apr 10, 2024
b65894d
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 10, 2024
c939e64
Fix
crazygao Apr 10, 2024
9274aaa
Fix
crazygao Apr 10, 2024
8a1548f
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 10, 2024
af8cb0e
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 10, 2024
b2c5bf5
Fix
crazygao Apr 10, 2024
c377730
Fix
crazygao Apr 10, 2024
ebd01fb
Fix global config
crazygao Apr 10, 2024
fc8a0ed
Fix
crazygao Apr 10, 2024
95b07d7
Fix
crazygao Apr 10, 2024
b3cd832
Fix
crazygao Apr 10, 2024
53000bf
Fix
crazygao Apr 10, 2024
1223055
Fix nits
crazygao Apr 10, 2024
a6d078b
Fix
crazygao Apr 10, 2024
8da2f5a
Fix
crazygao Apr 10, 2024
dcf67f8
Fix
crazygao Apr 11, 2024
3035885
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 11, 2024
a3b3af1
Fix
crazygao Apr 11, 2024
1d567c5
Fix
crazygao Apr 11, 2024
449ccec
Fix
crazygao Apr 11, 2024
9c9ce87
Fix
crazygao Apr 11, 2024
f6ae949
Fix
crazygao Apr 11, 2024
d682d4b
Fix
crazygao Apr 11, 2024
55805e2
Fix
crazygao Apr 11, 2024
e4e64c7
Fix
crazygao Apr 11, 2024
89ba770
Fix
crazygao Apr 11, 2024
60847c5
Fix
crazygao Apr 11, 2024
36b0882
Fix
crazygao Apr 11, 2024
dad0cb7
Fix
crazygao Apr 11, 2024
3d0a99e
Fix
crazygao Apr 11, 2024
31165e5
Fix pyproject
crazygao Apr 11, 2024
7d8207e
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 11, 2024
9340ac3
Fix
crazygao Apr 11, 2024
b43d162
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 11, 2024
794a39b
Merge branch 'main' into yigao/move_devkit_azure_tests
crazygao Apr 11, 2024
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
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"src/promptflow-azure/tests/**",
"src/promptflow-core/promptflow/core/_connection_provider/_models/**",
"src/promptflow/tests/**",
"src/promptflow-devkit/tests/**",
"src/promptflow-azure/tests/**",
"src/promptflow-recording/**",
"src/promptflow-tools/tests/**",
"src/promptflow-devkit/promptflow/_sdk/_service/static/index.html",
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/step_generate_configs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ runs:
shell: pwsh
run: |
pip list
pip install azure-identity
pip install azure-keyvault
echo "Generating connection config file..."
python ./scripts/building/generate_connection_config.py `
--target_folder ${{ inputs.targetFolder }}
97 changes: 47 additions & 50 deletions .github/workflows/promptflow-global-config-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,23 @@ on:
- cron: "40 18 * * *" # Every day starting at 2:40 BJT
pull_request_target:
paths:
- src/promptflow-core/*
- src/promptflow-core/**
- src/promptflow-devkit/**
- src/promptflow-tracing/**
- src/promptflow-azure/**
- src/promptflow/**
- scripts/building/**
- .github/workflows/promptflow-global-config-test.yml
workflow_dispatch:
env:
packageSetupType: promptflow_with_extra
testWorkingDirectory: ${{ github.workspace }}/src/promptflow
PYTHONPATH: ${{ github.workspace }}/src/promptflow
IS_IN_CI_PIPELINE: "true"
RECORD_DIRECTORY: ${{ github.workspace }}/src/promptflow-recording
TRACING_DIRECTORY: ${{ github.workspace }}/src/promptflow-tracing
CORE_DIRECTORY: ${{ github.workspace }}/src/promptflow-core
WORKING_DIRECTORY: ${{ github.workspace }}/src/promptflow-devkit
PROMPTFLOW_DIRECTORY: ${{ github.workspace }}/src/promptflow
TOOL_DIRECTORY: ${{ github.workspace }}/src/promptflow-tools
AZURE_DIRECTORY: ${{ github.workspace }}/src/promptflow-azure
jobs:
authorize:
environment:
Expand Down Expand Up @@ -41,70 +48,60 @@ jobs:
uses: "./.github/actions/step_merge_main"
- name: Display and Set Environment Variables
run: |
if [ "ubuntu-latest" == "${{ matrix.os }}" ]; then
export pyVersion="3.9";
elif [ "macos-latest" == "${{ matrix.os }}" ]; then
export pyVersion="3.10";
else
echo "Unsupported OS: ${{ matrix.os }}";
exit 1;
fi
export pyVersion="3.9"
env | sort >> $GITHUB_OUTPUT
id: display_env
shell: bash -el {0}
- name: Python Setup - ${{ matrix.os }} - Python Version ${{ steps.display_env.outputs.pyVersion }}
uses: "./.github/actions/step_create_python_environment"
- uses: actions/setup-python@v5
with:
pythonVersion: ${{ steps.display_env.outputs.pyVersion }}
- name: Build wheel
uses: "./.github/actions/step_sdk_setup"
with:
setupType: ${{ env.packageSetupType }}
scriptPath: ${{ env.testWorkingDirectory }}
- name: Install dependency
shell: pwsh
python-version: ${{ steps.display_env.outputs.pyVersion }}
- uses: snok/install-poetry@v1
- name: install test dependency group
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
pip uninstall -y promptflow-tracing
pip install ${{ github.workspace }}/src/promptflow-tracing
echo "Installed promptflow-tracing"
pip uninstall -y promptflow-core
pip install ${{ github.workspace }}/src/promptflow-core
pip uninstall -y promptflow-devkit
pip install ${{ github.workspace }}/src/promptflow-devkit
pip uninstall -y promptflow-azure
pip install ${{ github.workspace }}/src/promptflow-azure
pip freeze
set -xe
poetry install --only test
poetry run pip install ${{ env.TRACING_DIRECTORY }}
poetry run pip install ${{ env.CORE_DIRECTORY }}[azureml-serving]
poetry run pip install -e ${{ env.WORKING_DIRECTORY }}[pyarrow]
poetry run pip install -e ${{ env.AZURE_DIRECTORY }}

echo "Need to install promptflow to avoid tool dependency issue"
poetry run pip install ${{ env.PROMPTFLOW_DIRECTORY }}
poetry run pip install ${{ env.TOOL_DIRECTORY }}
poetry run pip install -e ${{ env.RECORD_DIRECTORY }}

poetry run pip show promptflow-tracing
poetry run pip show promptflow-core
poetry run pip show promptflow-devkit
poetry run pip show promptflow-azure
poetry run pip show promptflow-tools
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Install Azure Login items
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
pip install azure-identity
pip install azure-keyvault
- name: Generate Configs
uses: "./.github/actions/step_generate_configs"
with:
targetFolder: ${{ env.testWorkingDirectory }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Run Test
shell: pwsh
working-directory: ${{ env.testWorkingDirectory }}
targetFolder: ${{ env.PROMPTFLOW_DIRECTORY }}
- name: run devkit tests
run: |
gci env:* | sort-object name
az account show
python "../../scripts/building/run_coverage_tests.py" `
-p promptflow `
-t ${{ github.workspace }}/src/promptflow/tests/sdk_cli_global_config_test `
-l eastus `
-m "unittest or e2etest" `
-n ${{ steps.cpu-cores.outputs.count }} `
poetry run pytest ./tests/sdk_cli_global_config_test -p promptflow --cov=promptflow --cov-config=pyproject.toml \
--cov-report=term --cov-report=html --cov-report=xml -n auto -m "unittest or e2etest"
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (Python ${{ steps.display_env.outputs.pyVersion }}) (OS ${{ matrix.os }})
path: |
${{ env.testWorkingDirectory }}/*.xml
${{ env.testWorkingDirectory }}/htmlcov/
${{ env.WORKING_DIRECTORY }}/*.xml
${{ env.WORKING_DIRECTORY }}/htmlcov/
publish-test-results-global-config-test:
needs: sdk_cli_global_config_tests
runs-on: ubuntu-latest
Expand All @@ -117,7 +114,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Publish Test Results
Expand Down
151 changes: 42 additions & 109 deletions .github/workflows/promptflow-sdk-cli-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,15 @@ on:
- src/promptflow-recording/**
workflow_dispatch:
env:
packageSetupType: promptflow_with_extra
testWorkingDirectory: ${{ github.workspace }}/src/promptflow
PYTHONPATH: ${{ github.workspace }}/src/promptflow
IS_IN_CI_PIPELINE: "true"
RECORD_DIRECTORY: ${{ github.workspace }}/src/promptflow-recording
TRACING_DIRECTORY: ${{ github.workspace }}/src/promptflow-tracing
CORE_DIRECTORY: ${{ github.workspace }}/src/promptflow-core
WORKING_DIRECTORY: ${{ github.workspace }}/src/promptflow-devkit
PROMPTFLOW_DIRECTORY: ${{ github.workspace }}/src/promptflow
TOOL_DIRECTORY: ${{ github.workspace }}/src/promptflow-tools
jobs:
build:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Display and Set Environment Variables
run: |
env | sort >> $GITHUB_OUTPUT
id: display_env
shell: bash -el {0}
- name: Python Setup - ubuntu-latest - Python Version 3.9
uses: "./.github/actions/step_create_python_environment"
with:
pythonVersion: 3.9
- name: Build wheel
uses: "./.github/actions/step_sdk_setup"
with:
setupType: promptflow_with_extra
scriptPath: ${{ env.testWorkingDirectory }}
- name: Upload Wheel
if: always()
uses: actions/upload-artifact@v3
with:
name: wheel
path: |
${{ github.workspace }}/src/promptflow/dist/*.whl
${{ github.workspace }}/src/promptflow-tools/dist/*.whl
sdk_cli_tests:
needs: build
strategy:
fail-fast: false
matrix:
Expand All @@ -59,39 +31,29 @@ jobs:
steps:
- name: set test mode
run: echo "PROMPT_FLOW_TEST_MODE=$(if [[ "${{ github.event_name }}" == "pull_request" ]]; then echo replay; else echo live; fi)" >> $GITHUB_ENV
- name: checkout
uses: actions/checkout@v4
- name: Display and Set Environment Variables
run: |
env | sort >> $GITHUB_OUTPUT
id: display_env
shell: bash -el {0}
- name: Python Setup - ${{ matrix.os }} - Python Version ${{ matrix.pythonVersion }}
uses: "./.github/actions/step_create_python_environment"
with:
pythonVersion: ${{ matrix.pythonVersion }}
- name: Download Artifacts
uses: actions/download-artifact@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
name: wheel
path: artifacts
- name: Install wheel
shell: pwsh
working-directory: artifacts
run: |
Set-PSDebug -Trace 1
pip install -r ${{ github.workspace }}/src/promptflow/dev_requirements.txt
pip install ${{ github.workspace }}/src/promptflow-tracing
pip install ${{ github.workspace }}/src/promptflow-core
pip install ${{ github.workspace }}/src/promptflow-devkit[pyarrow]
pip install ${{ github.workspace }}/src/promptflow
gci ./promptflow-tools -Recurse | % {if ($_.Name.Contains('.whl')) {python -m pip install $_.FullName}}
pip freeze
- name: install recording
python-version: ${{ matrix.pythonVersion }}
- uses: snok/install-poetry@v1
- name: install test dependency group
run: |
pip install vcrpy
pip install .
working-directory: ${{ env.RECORD_DIRECTORY }}
set -xe
poetry install --only test
poetry run pip install ${{ env.TRACING_DIRECTORY }}
poetry run pip install ${{ env.CORE_DIRECTORY }}[azureml-serving]
poetry run pip install -e ${{ env.WORKING_DIRECTORY }}[pyarrow]

echo "Need to install promptflow to avoid tool dependency issue"
poetry run pip install ${{ env.PROMPTFLOW_DIRECTORY }}
poetry run pip install ${{ env.TOOL_DIRECTORY }}
poetry run pip install -e ${{ env.RECORD_DIRECTORY }}

poetry run pip show promptflow-tracing
poetry run pip show promptflow-core
poetry run pip show promptflow-devkit
poetry run pip show promptflow-tools
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Azure login (non pull_request workflow)
if: github.event_name != 'pull_request'
uses: azure/login@v1
Expand All @@ -101,62 +63,33 @@ jobs:
if: github.event_name != 'pull_request'
uses: "./.github/actions/step_generate_configs"
with:
targetFolder: ${{ env.testWorkingDirectory }}
targetFolder: ${{ env.PROMPTFLOW_DIRECTORY }}
- name: generate live test resources (pull_request workflow)
if: github.event_name == 'pull_request'
shell: pwsh
working-directory: ${{ env.testWorkingDirectory }}
working-directory: ${{ env.PROMPTFLOW_DIRECTORY }}
run: |
cp ${{ github.workspace }}/src/promptflow/dev-connections.json.example ${{ github.workspace }}/src/promptflow/connections.json
- name: Run SDK CLI Test
shell: pwsh
working-directory: ${{ env.testWorkingDirectory }}
run: |
python "../../scripts/building/run_coverage_tests.py" `
-p promptflow `
-t ${{ github.workspace }}/src/promptflow/tests/sdk_cli_test `
-l eastus `
-m "unittest or e2etest" `
--coverage-config ${{ github.workspace }}/src/promptflow/tests/sdk_cli_test/.coveragerc `
-o "${{ env.testWorkingDirectory }}/test-results-sdk-cli.xml" `
--ignore-glob ${{ github.workspace }}/src/promptflow/tests/sdk_cli_test/e2etests/test_executable.py
- name: Install pf executable
shell: pwsh
working-directory: artifacts
- name: run devkit tests
run: |
Set-PSDebug -Trace 1
pip install ${{ github.workspace }}/src/promptflow-devkit[pyarrow,executable]
pip freeze
- name: Run SDK CLI Executable Test
shell: pwsh
working-directory: ${{ env.testWorkingDirectory }}
run: |
python "../../scripts/building/run_coverage_tests.py" `
-p promptflow `
-t ${{ github.workspace }}/src/promptflow/tests/sdk_cli_test/e2etests/test_executable.py `
-l eastus `
-m "unittest or e2etest" `
-o "${{ env.testWorkingDirectory }}/test-results-sdk-cli-executable.xml"
- name: Run PFS Test
shell: pwsh
working-directory: ${{ env.testWorkingDirectory }}
run: |
python "../../scripts/building/run_coverage_tests.py" `
-p promptflow `
-t ${{ github.workspace }}/src/promptflow/tests/sdk_pfs_test `
-l eastus `
-m "e2etest" `
--coverage-config ${{ github.workspace }}/src/promptflow/tests/sdk_pfs_test/.coveragerc `
-o "${{ env.testWorkingDirectory }}/test-results-pfs.xml"
poetry run pytest ./tests/sdk_cli_test ./tests/sdk_pfs_test -p promptflow --cov=promptflow --cov-config=pyproject.toml \
--cov-report=term --cov-report=html --cov-report=xml -n auto -m "unittest or e2etest" \
--ignore-glob ./tests/sdk_cli_test/e2etests/test_executable.py
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: Test Results (Python ${{ matrix.pythonVersion }}) (OS ${{ matrix.os }})
path: |
${{ env.testWorkingDirectory }}/*.xml
${{ env.testWorkingDirectory }}/htmlcov/
${{ env.testWorkingDirectory }}/tests/sdk_cli_test/count.json
${{ env.WORKING_DIRECTORY }}/*.xml
${{ env.WORKING_DIRECTORY }}/htmlcov/
${{ env.WORKING_DIRECTORY }}/tests/sdk_cli_test/count.json
- run: poetry run pip install -e ${{ env.WORKING_DIRECTORY }}[executable]
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: run devkit executable tests
run: |
poetry run pytest -n auto -m "unittest or e2etest" ./tests/sdk_cli_test/e2etests/test_executable.py
working-directory: ${{ env.WORKING_DIRECTORY }}


publish-test-results-sdk-cli-test:
Expand Down
Loading
Loading