-
Notifications
You must be signed in to change notification settings - Fork 899
131 lines (130 loc) · 4.47 KB
/
promptflow-global-config-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: promptflow-global-config-test
on:
schedule:
- cron: "40 18 * * *" # Every day starting at 2:40 BJT
pull_request_target:
paths:
- src/promptflow-core/*
- 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"
jobs:
authorize:
environment:
# forked prs from pull_request_target will be run in external environment, domain prs will be run in internal environment
${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
'external' || 'internal' }}
runs-on: ubuntu-latest
steps:
- run: true
sdk_cli_global_config_tests:
needs: authorize
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
fetch-depth: 0
- name: merge main to current branch
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
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: Install dependency
shell: pwsh
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
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- 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 }}
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 }} `
- 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-global-config-test:
needs: sdk_cli_global_config_tests
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
if: always()
steps:
- name: checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Publish Test Results
uses: "./.github/actions/step_publish_test_results"
with:
testActionFileName: promptflow-global-config-test.yml
testResultTitle: SDK CLI Global Config Test Result
osVersion: ubuntu-latest
pythonVersion: 3.9
coverageThreshold: 0
context: test/sdk_cli