@@ -6,11 +6,6 @@ name: Build
6
6
on :
7
7
push :
8
8
branches : ["main"]
9
- paths :
10
- - " autogen/**"
11
- - " test/**"
12
- - " .github/workflows/build.yml"
13
- - " setup.py"
14
9
pull_request :
15
10
branches : ["main"]
16
11
merge_group :
@@ -21,7 +16,39 @@ concurrency:
21
16
cancel-in-progress : ${{ github.ref != 'refs/heads/main' }}
22
17
permissions : {}
23
18
jobs :
19
+ paths-filter :
20
+ runs-on : ubuntu-latest
21
+ outputs :
22
+ hasChanges : ${{ steps.filter.outputs.autogen == 'true' || steps.filter.outputs.test == 'true' || steps.filter.outputs.workflows == 'true' || steps.filter.outputs.setup == 'true' }}
23
+ steps :
24
+ - uses : actions/checkout@v4
25
+ - uses : dorny/paths-filter@v2
26
+ id : filter
27
+ with :
28
+ filters : |
29
+ autogen:
30
+ - "autogen/**"
31
+ test:
32
+ - "test/**"
33
+ workflows:
34
+ - ".github/workflows/**"
35
+ setup:
36
+ - "setup.py"
37
+ - name : autogen has changes
38
+ run : echo "autogen has changes"
39
+ if : steps.filter.outputs.autogen == 'true'
40
+ - name : test has changes
41
+ run : echo "test has changes"
42
+ if : steps.filter.outputs.test == 'true'
43
+ - name : workflows has changes
44
+ run : echo "workflows has changes"
45
+ if : steps.filter.outputs.workflows == 'true'
46
+ - name : setup has changes
47
+ run : echo "setup has changes"
48
+ if : steps.filter.outputs.setup == 'true'
24
49
build :
50
+ needs : paths-filter
51
+ if : needs.paths-filter.outputs.hasChanges == 'true'
25
52
runs-on : ${{ matrix.os }}
26
53
env :
27
54
AUTOGEN_USE_DOCKER : ${{ matrix.os != 'ubuntu-latest' && 'False' }}
30
57
matrix :
31
58
os : [ubuntu-latest, macos-latest, windows-latest]
32
59
python-version : ["3.8", "3.9", "3.10", "3.11", "3.12"]
60
+ exclude :
61
+ - os : macos-latest
62
+ python-version : " 3.8"
63
+ - os : macos-latest
64
+ python-version : " 3.9"
33
65
steps :
34
66
- uses : actions/checkout@v4
35
67
- name : Set up Python ${{ matrix.python-version }}
39
71
- name : Install packages and dependencies
40
72
run : |
41
73
python -m pip install --upgrade pip wheel
42
- pip install -e .
74
+ pip install -e .[cosmosdb]
43
75
python -c "import autogen"
44
- pip install pytest mock
76
+ pip install pytest-cov>=5 mock
45
77
- name : Install optional dependencies for code executors
46
78
# code executors and udfs auto skip without deps, so only run for python 3.11
47
79
if : matrix.python-version == '3.11'
@@ -57,20 +89,52 @@ jobs:
57
89
- name : Test with pytest skipping openai tests
58
90
if : matrix.python-version != '3.10' && matrix.os == 'ubuntu-latest'
59
91
run : |
60
- pytest test --skip-openai --durations=10 --durations-min=1.0
92
+ pytest test --ignore=test/agentchat/contrib -- skip-openai --durations=10 --durations-min=1.0
61
93
- name : Test with pytest skipping openai and docker tests
62
94
if : matrix.python-version != '3.10' && matrix.os != 'ubuntu-latest'
63
95
run : |
64
- pytest test --skip-openai --skip-docker --durations=10 --durations-min=1.0
65
- - name : Coverage
96
+ pytest test --ignore=test/agentchat/contrib -- skip-openai --skip-docker --durations=10 --durations-min=1.0
97
+ - name : Coverage with Redis
66
98
if : matrix.python-version == '3.10'
67
99
run : |
68
100
pip install -e .[test,redis,websockets]
69
- coverage run -a -m pytest test --ignore=test/agentchat/contrib --skip-openai --durations=10 --durations-min=1.0
70
- coverage xml
101
+ pytest test --ignore=test/agentchat/contrib --skip-openai --durations=10 --durations-min=1.0
102
+ - name : Test with Cosmos DB
103
+ run : |
104
+ pip install -e .[test,cosmosdb]
105
+ pytest test/cache/test_cosmos_db_cache.py --skip-openai --durations=10 --durations-min=1.0
71
106
- name : Upload coverage to Codecov
72
107
if : matrix.python-version == '3.10'
73
108
uses : codecov/codecov-action@v3
74
109
with :
75
110
file : ./coverage.xml
76
111
flags : unittests
112
+ build-check :
113
+ if : always()
114
+ runs-on : ubuntu-latest
115
+ needs : [build]
116
+ steps :
117
+ - name : Get Date
118
+ shell : bash
119
+ run : |
120
+ echo "date=$(date +'%m/%d/%Y %H:%M:%S')" >> "$GITHUB_ENV"
121
+
122
+ - name : Run Type is ${{ github.event_name }}
123
+ if : ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'}}
124
+ shell : bash
125
+ run : |
126
+ echo "run_type=${{ github.event_name }}" >> "$GITHUB_ENV"
127
+
128
+ - name : Fail workflow if build failed
129
+ id : check_build_failed
130
+ if : contains(join(needs.*.result, ','), 'failure')
131
+ uses : actions/github-script@v6
132
+ with :
133
+ script : core.setFailed('Build Failed!')
134
+
135
+ - name : Fail workflow if build cancelled
136
+ id : check_build_cancelled
137
+ if : contains(join(needs.*.result, ','), 'cancelled')
138
+ uses : actions/github-script@v6
139
+ with :
140
+ script : core.setFailed('Build Cancelled!')
0 commit comments