[PromptFlow] Optimize memory computation #768
Workflow file for this run
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
# execute tests in src/promptflow/tests/sdk_cli_azure_test | |
# when pull_request triggers, use replay test mode | |
# otherwise (schedule/workflow_disptach), use live test mode | |
name: sdk-cli-azure-test | |
on: | |
pull_request: | |
paths: | |
- src/promptflow/** | |
- scripts/building/** | |
- .github/workflows/promptflow-sdk-cli-azure-test.yml | |
schedule: | |
- cron: "30 20 * * *" # 4:30 Beijing Time (GMT+8) | |
workflow_dispatch: | |
env: | |
packageSetupType: promptflow_with_extra | |
testWorkingDirectory: ${{ github.workspace }}/src/promptflow | |
PYTHONPATH: ${{ github.workspace }}/src/promptflow | |
IS_IN_CI_PIPELINE: "true" | |
jobs: | |
sdk_cli_azure_test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
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: check test mode from env | |
run: echo $PROMPT_FLOW_TEST_MODE | |
- name: checkout | |
uses: actions/checkout@v4 | |
- 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 | |
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" | |
with: | |
pythonVersion: ${{ steps.display_env.outputs.pyVersion }} | |
- name: Build wheel | |
uses: "./.github/actions/step_sdk_setup" | |
with: | |
setupType: ${{ env.packageSetupType }} | |
scriptPath: ${{ env.testWorkingDirectory }} | |
- name: Get number of CPU cores | |
uses: SimenB/github-actions-cpu-cores@v1 | |
id: cpu-cores | |
- name: Azure login (non pull_request workflow) | |
if: github.event_name != 'pull_request' | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: generate live test resources (non pull_request workflow) | |
if: github.event_name != 'pull_request' | |
uses: "./.github/actions/step_generate_configs" | |
with: | |
targetFolder: ${{ env.testWorkingDirectory }} | |
- name: Run Test | |
shell: pwsh | |
working-directory: ${{ env.testWorkingDirectory }} | |
run: | | |
gci env:* | sort-object name | |
python "../../scripts/building/run_coverage_tests.py" ` | |
-p promptflow ` | |
-t ${{ github.workspace }}/src/promptflow/tests/sdk_cli_azure_test ` | |
-l eastus ` | |
-m "unittest or e2etest" ` | |
-n ${{ steps.cpu-cores.outputs.count }} ` | |
--coverage-config ${{ github.workspace }}/src/promptflow/tests/sdk_cli_test/.coveragerc | |
- 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/ | |
publish-test-results: | |
name: "Publish Tests Results" | |
needs: sdk_cli_azure_test | |
runs-on: ubuntu-latest | |
permissions: write-all | |
if: always() | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Publish Test Results | |
uses: "./.github/actions/step_publish_test_results" | |
with: | |
testActionFileName: promptflow-sdk-cli-azure-e2e-test.yml | |
testResultTitle: promptflow SDK CLI Azure E2E Test Result | |
osVersion: ubuntu-latest | |
pythonVersion: 3.9 | |
coverageThreshold: 40 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
context: test/sdk_cli |