-
Notifications
You must be signed in to change notification settings - Fork 128
114 lines (99 loc) · 3.54 KB
/
promptflow-ci.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
name: Promptflow CI
on:
# Triggers the Promptflow CI on pull request targeting the main branch
workflow_dispatch:
pull_request:
branches:
- main
pull_request_target:
branches:
- main
types:
- opened
- labeled
- synchronize
- reopened
env:
PROMPTFLOW_DIR: "assets/promptflow/models"
permissions:
# Required for OIDC login to Azure
id-token: write
# Required to clone repo
contents: read
jobs:
check-execution-context:
uses: Azure/azureml-assets/.github/workflows/check-execution-context.yaml@main
check-directory-file-changes:
needs: check-execution-context
if: fromJSON(needs.check-execution-context.outputs.continue)
uses: Azure/azureml-assets/.github/workflows/check-changed-files.yaml@main
with:
folder_path: "assets/promptflow/models/**,.github/workflows/promptflow-ci.yml,scripts/promptflow-ci/**"
forked_pr_input: ${{ needs.check-execution-context.outputs.forked_pr }}
check_spec_yaml:
runs-on: ubuntu-latest
if: needs.check-directory-file-changes.outputs.files-changed != ''
needs: [check-execution-context, check-directory-file-changes]
name: Check spec.yaml fields
timeout-minutes: 45
steps:
- name: Clone branch
uses: Azure/azureml-assets/.github/actions/clone-repo@main
with:
forked-pr: ${{ needs.check-execution-context.outputs.forked_pr }}
fetch-depth: 2
- name: Set up Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Check spec yaml
run: |-
pip install PyYAML
python scripts/promptflow-ci/check_spec_yaml.py --models_dir ${{ env.PROMPTFLOW_DIR }}
run_promptflow_ci_job:
runs-on: ubuntu-latest
if: needs.check-directory-file-changes.outputs.files-changed != ''
needs: [check-execution-context, check-directory-file-changes]
name: Flow tests
environment: Testing
timeout-minutes: 60
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Clone branch
uses: Azure/azureml-assets/.github/actions/clone-repo@main
with:
forked-pr: ${{ needs.check-execution-context.outputs.forked_pr }}
fetch-depth: 2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Install cspell
run: npm install -g cspell
- name: Set up Python 3.9 environment
uses: actions/setup-python@v4
with:
python-version: "3.9"
- run: |
python -m pip install --upgrade pip
pip install -r scripts/promptflow-ci/requirement.txt
- name: Azure login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_PROMPT_FLOW_SUBSCRIPTION_ID }}
- name: Validate prompt flows
run: |
python scripts/promptflow-ci/promptflow_ci.py
- name: Run cspell for typo check
working-directory: ${{ env.PROMPTFLOW_DIR }}
run: |-
cspell lint "**" > cspell_check.log || true
if [ -s cspell_check.log ]; then
echo -e "\e[91mNote: If the detected words are expected, add them into "assets/promptflow/.cspell.json"\e[0m"
echo -e "====================== Summary of cspell errors ======================"
echo -e "\e[31m$(cat cspell_check.log)\e[0m"
exit 1
fi
rm -rf cspell_check.log