forked from microsoft/promptflow
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (44 loc) · 1.77 KB
/
tools_tests.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
name: tools_tests
on:
# Triggers the workflow pull request events but only for the main branch
pull_request:
branches: [ main ]
jobs:
run_tool_ci_job:
# The type of runner that the job will run on
runs-on: ubuntu-latest
name: Tool Test
timeout-minutes: 30
steps:
- name: Check for dockerenv file
run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v3
- name: Check for changes
id: check_changes
run: |
git fetch origin ${{ github.base_ref }} # Fetch the base branch
CHANGED=$(git diff --name-only FETCH_HEAD..HEAD -- 'src/promptflow-tools/')
if [ -n "$CHANGED" ]; then
echo "Changes detected in src/promptflow-tools/"
echo "run_tests=true" >> $GITHUB_OUTPUT
else
echo "No changes detected in src/promptflow-tools/"
echo "run_tests=false" >> $GITHUB_OUTPUT
fi
- name: Setup
if: steps.check_changes.outputs.run_tests == 'true'
run: |
python -m pip install --upgrade pip
pip install promptflow
pip install pytest pytest_mock
pip install azure-identity azure-keyvault-secrets
- name: Generate configs
if: steps.check_changes.outputs.run_tests == 'true'
run: |
python ./scripts/tool/generate_connection_config.py --tenant_id ${{ secrets.TENANT_ID }} --client_id ${{ secrets.CLIENT_ID }} --client_secret ${{ secrets.CLIENT_SECRET }}
- name: Run tests
if: steps.check_changes.outputs.run_tests == 'true'
run: |
pytest ./src/promptflow-tools/tests