forked from Arize-ai/openinference
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (79 loc) · 2.48 KB
/
python-CI.yaml
File metadata and controls
84 lines (79 loc) · 2.48 KB
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
name: Python CI
on:
push:
branches: [ main ]
pull_request:
paths:
- "python/**"
workflow_dispatch:
concurrency:
group: test-python-${{ github.head_ref }}
cancel-in-progress: true
jobs:
changes:
name: Filter Changes
runs-on: ubuntu-latest
outputs:
diff: ${{ steps.filter.outputs.diff }}
diff_files: ${{ steps.filter.outputs.diff_files }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
list-files: json
filters: |
diff:
- "python/instrumentation/**/*.py"
- "python/instrumentation/**/*.pyi"
- "python/instrumentation/**/*.toml"
- "python/instrumentation/**/*.yaml"
- "python/openinference-*/**/*.py"
- "python/openinference-*/**/*.pyi"
- "python/openinference-*/**/*.toml"
- "python/openinference-*/**/*.yaml"
find-tox-testenv:
name: Find Tox Testenv
needs: changes
if: ${{ needs.changes.outputs.diff == 'true' }}
runs-on: ubuntu-latest
outputs:
list: ${{ steps.testenv.outputs.list }}
steps:
- name: Find tox environments to run
uses: actions/checkout@v4
with:
sparse-checkout: python
- uses: astral-sh/setup-uv@v5
with:
version: 0.6.3
enable-cache: false
- run: |
DIFF_FILES='${{ needs.changes.outputs.diff_files }}'
TOX_ENVIRONMENTS=$(uvx --with tox-uv tox list | grep ^py | awk '{print $1}' | jq -R . | jq -sc .)
SELECTED_TOX_ENVIRONMENTS=$(python3 scripts/select_tox_environments.py "$DIFF_FILES" "$TOX_ENVIRONMENTS")
echo "list=$SELECTED_TOX_ENVIRONMENTS" >> $GITHUB_OUTPUT
working-directory: python
id: testenv
- name: Fail if no testenv is found
if: ${{ steps.testenv.outputs.list == '[]' }}
run: exit 1
run-tox-testenv:
name: ${{ matrix.testenv }}
needs: find-tox-testenv
if: ${{ needs.find-tox-testenv.outputs.list != '[]' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testenv: ${{ fromJSON(needs.find-tox-testenv.outputs.list) }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: python
- uses: astral-sh/setup-uv@v5
with:
version: 0.6.3
enable-cache: false
- run: uvx --with tox-uv tox run -e ${{ matrix.testenv }}
working-directory: python