@@ -5,200 +5,37 @@ name: Build and test HolmesGPT
55on : [push, pull_request, workflow_dispatch]
66
77jobs :
8+ # Pre-commit checks job
89 check :
910 name : Pre-commit checks
1011 runs-on : ubuntu-latest
1112 steps :
1213 - uses : actions/checkout@v4
14+
1315 - uses : actions/setup-python@v5
16+ with :
17+ python-version : ' 3.11'
18+
1419 - name : Install Poetry
1520 uses : snok/install-poetry@v1
1621 with :
1722 virtualenvs-create : true
1823 virtualenvs-in-project : true
1924 virtualenvs-path : .venv
2025 installer-parallel : true
26+
2127 - name : Install dependencies
2228 run : poetry install --no-interaction --no-root
29+
2330 -
uses :
pre-commit/[email protected] 24- build :
25- needs : check
26- strategy :
27- matrix :
28- python-version : ["3.10", "3.11", "3.12"]
29-
30- runs-on : ubuntu-latest
31-
32- steps :
33- - uses : actions/checkout@v2
34-
35- - name : Set up Python ${{ matrix.python-version }}
36- uses : actions/setup-python@v2
37- with :
38- python-version : ${{ matrix.python-version }}
39-
40- - name : Install Python dependencies and build
41- # if you change something here, you must also change it in .github/workflows/build-binaries-and-brew.yaml
42- run : |
43- python -m pip install --upgrade pip setuptools pyinstaller
44-
45- curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0
46- poetry config virtualenvs.create false
47- poetry install --no-root
4831
49- sudo apt-get install -y binutils
50- pyinstaller holmes_cli.py \
51- --name holmes \
52- --add-data 'holmes/plugins/runbooks/*:holmes/plugins/runbooks' \
53- --add-data 'holmes/plugins/prompts/*:holmes/plugins/prompts' \
54- --add-data 'holmes/plugins/toolsets/*:holmes/plugins/toolsets' \
55- --add-data 'holmes/plugins/toolsets/coralogix*:holmes/plugins/toolsets/coralogix' \
56- --add-data 'holmes/plugins/toolsets/grafana*:holmes/plugins/toolsets/grafana' \
57- --add-data 'holmes/plugins/toolsets/internet*:holmes/plugins/toolsets/internet' \
58- --add-data 'holmes/plugins/toolsets/opensearch*:holmes/plugins/toolsets/opensearch' \
59- --add-data 'holmes/plugins/toolsets/prometheus*:holmes/plugins/toolsets/prometheus' \
60- --hidden-import=tiktoken_ext.openai_public \
61- --hidden-import=tiktoken_ext \
62- --hiddenimport litellm.llms.tokenizers \
63- --hiddenimport litellm.litellm_core_utils.tokenizers \
64- --collect-data litellm
65- ls dist
66-
67- - name : Run tests
68- shell : bash
69- env :
70- OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
71- run : |
72- poetry run pytest -m "not llm"
73-
74- - name : Test the binary
75- shell : bash
76- run : |
77- dist/holmes/holmes version
78- if [ $? -ne 0 ]; then
79- echo "Binary test failed"
80- exit 1
81- fi
82- echo "Binary test passed"
83-
84- build-windows :
32+ build-and-test :
8533 needs : check
86- strategy :
87- matrix :
88- python-version : ["3.10", "3.11", "3.12"]
89-
90- runs-on : windows-latest
91-
92- steps :
93- - uses : actions/checkout@v4
94-
95- - name : Set up Python ${{ matrix.python-version }}
96- uses : actions/setup-python@v4
97- with :
98- python-version : ${{ matrix.python-version }}
99-
100- - name : Install Python dependencies and build
101- shell : pwsh
102- run : |
103- python -m pip install --upgrade pip setuptools pyinstaller
104-
105- # Install Poetry using pip for consistency
106- pip install poetry==1.4.0
107- poetry config virtualenvs.create false
108- poetry install --no-root
109-
110- # Build binary with PyInstaller (PowerShell backticks and Windows ';' separators)
111- pyinstaller holmes_cli.py `
112- --name holmes `
113- --add-data "holmes/plugins/runbooks/*;holmes/plugins/runbooks" `
114- --add-data "holmes/plugins/prompts/*;holmes/plugins/prompts" `
115- --add-data "holmes/plugins/toolsets/*;holmes/plugins/toolsets" `
116- --add-data "holmes/plugins/toolsets/coralogix*;holmes/plugins/toolsets/coralogix" `
117- --add-data "holmes/plugins/toolsets/grafana*;holmes/plugins/toolsets/grafana" `
118- --add-data "holmes/plugins/toolsets/internet*;holmes/plugins/toolsets/internet" `
119- --add-data "holmes/plugins/toolsets/opensearch*;holmes/plugins/toolsets/opensearch" `
120- --add-data "holmes/plugins/toolsets/prometheus*;holmes/plugins/toolsets/prometheus" `
121- --hidden-import=tiktoken_ext.openai_public `
122- --hidden-import=tiktoken_ext `
123- --hidden-import=litellm.llms.tokenizers `
124- --hidden-import=litellm.litellm_core_utils.tokenizers `
125- --collect-data litellm
126- dir dist
127-
128- - name : Run tests
129- shell : powershell
130- env :
131- OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
132- run : |
133- poetry run pytest -m "not llm"
134-
135- - name : Test the binary
136- shell : powershell
137- run : |
138- & "dist\holmes\holmes.exe" version
139- if ($LASTEXITCODE -ne 0) {
140- Write-Host "Binary test failed"
141- exit 1
142- }
143- Write-Host "Binary test passed"
144-
145- build-macos :
146- needs : check
147- strategy :
148- matrix :
149- python-version : ["3.10", "3.11", "3.12"]
150-
151- runs-on : macos-latest
152-
153- steps :
154- - uses : actions/checkout@v4
155-
156- - name : Set up Python ${{ matrix.python-version }}
157- uses : actions/setup-python@v5
158- with :
159- python-version : ${{ matrix.python-version }}
160- - name : Install Python dependencies and build
161- run : |
162- python -m pip install --upgrade pip setuptools pyinstaller
163-
164- # Install Poetry using curl (consistent with Linux)
165- curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0
166- poetry config virtualenvs.create false
167- poetry install --no-root
168-
169- # Install macOS system dependencies
170- brew install unixodbc
171-
172- pyinstaller holmes_cli.py \
173- --name holmes \
174- --add-data 'holmes/plugins/runbooks/*:holmes/plugins/runbooks' \
175- --add-data 'holmes/plugins/prompts/*:holmes/plugins/prompts' \
176- --add-data 'holmes/plugins/toolsets/*:holmes/plugins/toolsets' \
177- --add-data 'holmes/plugins/toolsets/coralogix*:holmes/plugins/toolsets/coralogix' \
178- --add-data 'holmes/plugins/toolsets/grafana*:holmes/plugins/toolsets/grafana' \
179- --add-data 'holmes/plugins/toolsets/internet*:holmes/plugins/toolsets/internet' \
180- --add-data 'holmes/plugins/toolsets/opensearch*:holmes/plugins/toolsets/opensearch' \
181- --add-data 'holmes/plugins/toolsets/prometheus*:holmes/plugins/toolsets/prometheus' \
182- --hidden-import=tiktoken_ext.openai_public \
183- --hidden-import=tiktoken_ext \
184- --hidden-import=litellm.llms.tokenizers \
185- --hidden-import=litellm.litellm_core_utils.tokenizers \
186- --collect-data litellm
187- ls dist
188-
189- - name : Run tests
190- shell : bash
191- env :
192- OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
193- run : |
194- poetry run pytest -m "not llm"
195-
196- - name : Test the binary
197- shell : bash
198- run : |
199- dist/holmes/holmes version
200- if [ $? -ne 0 ]; then
201- echo "Binary test failed"
202- exit 1
203- fi
204- echo "Binary test passed"
34+ if : always() && (needs.check.result == 'success' || needs.check.result == 'skipped')
35+ uses : ./.github/workflows/build-template.yaml
36+ with :
37+ python-versions-matrix : ' ["3.10", "3.11", "3.12"]'
38+ os-matrix : ' ["ubuntu-latest", "windows-latest", "macos-latest"]'
39+ run-tests : true
40+ is-release : false
41+ secrets : inherit
0 commit comments