-
Couldn't load subscription status.
- Fork 182
Adding build check in windows and mac #913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aritraghosh
wants to merge
13
commits into
robusta-dev:master
Choose a base branch
from
aritraghosh:buildcheck
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+340
−264
Open
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c8c0a08
Adding build in windows and mac
aritraghosh 94cc327
Update .github/workflows/build-and-test.yaml
aritraghosh 7fa3a9f
Update .github/workflows/build-and-test.yaml
aritraghosh e511986
Update .github/workflows/build-and-test.yaml
aritraghosh 438b09b
use template for test and release
mainred 381946a
add python script path to system path
mainred 517189b
use pwsh for windows
mainred ac283e6
fix poetry is not found on windows
mainred b1b5017
use poetry 1.8.4 by default
mainred 7f019c7
Merge branch 'master' of github.com:robusta-dev/holmesgpt into buildc…
mainred c3b761c
Re-trigger CI
mainred 8867692
address AI comments
mainred c278f18
Merge branch 'master' of github.com:robusta-dev/holmesgpt into buildc…
mainred File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| name: Build and Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [ created ] | ||
|
|
||
| jobs: | ||
| # Use the reusable workflow for building binaries | ||
| build: | ||
| uses: ./.github/workflows/build-template.yaml | ||
| with: | ||
| python-version: "3.11" | ||
| python-versions-matrix: '["3.11"]' | ||
| # We build on an older Ubuntu as pyinstaller binaries are forward-compatible not backwards-compatible | ||
| # See https://pyinstaller.org/en/stable/usage.html?highlight=glibc#making-gnu-linux-apps-forward-compatible:~:text=The%20solution%20is%20to%20always%20build%20your%20app%20on%20the%20oldest%20version%20of%20GNU/Linux%20you%20mean%20to%20support.%20It%20should%20continue%20to%20work%20with%20the%20libc%20found%20on%20newer%20versions. | ||
| # TODO: for similar reasons, we may want to build on older Windows/MacOS versions as well | ||
| os-matrix: '["ubuntu-22.04", "windows-latest", "macos-latest"]' | ||
| is-release: true | ||
| secrets: inherit | ||
|
|
||
| # Latest release check job | ||
| check-latest: | ||
| name: Check if Latest Release | ||
| needs: build | ||
| runs-on: ubuntu-22.04 | ||
| outputs: | ||
| IS_LATEST: ${{ steps.check-latest.outputs.release == github.ref_name }} | ||
| steps: | ||
| - id: check-latest | ||
| uses: pozetroninc/[email protected] | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| repository: ${{ github.repository }} | ||
| excludes: prerelease, draft | ||
|
|
||
| # macOS hash calculation job | ||
| mac-hash: | ||
| name: Calculate macOS Hash | ||
| needs: check-latest | ||
| runs-on: ubuntu-latest | ||
| if: needs.check-latest.outputs.IS_LATEST | ||
| outputs: | ||
mainred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| MAC_BUILD_HASH: ${{ steps.calc-hash.outputs.MAC_BUILD_HASH }} | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v2 | ||
mainred marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - name: Download MacOS artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: holmes-macos-latest-${{ github.ref_name }} | ||
| - name: Calculate hash | ||
| id: calc-hash | ||
| run: echo "::set-output name=MAC_BUILD_HASH::$(sha256sum holmes-macos-latest-${{ github.ref_name }}.zip | awk '{print $1}')" | ||
|
|
||
mainred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Linux hash calculation job | ||
| linux-hash: | ||
| name: Calculate Linux Hash | ||
| needs: check-latest | ||
| runs-on: ubuntu-latest | ||
| if: needs.check-latest.outputs.IS_LATEST | ||
| outputs: | ||
| LINUX_BUILD_HASH: ${{ steps.calc-hash.outputs.LINUX_BUILD_HASH }} | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v2 | ||
| - name: Download Linux artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: holmes-ubuntu-22.04-${{ github.ref_name }} | ||
| - name: Calculate hash | ||
| id: calc-hash | ||
| run: echo "::set-output name=LINUX_BUILD_HASH::$(sha256sum holmes-ubuntu-22.04-${{ github.ref_name }}.zip | awk '{print $1}')" | ||
|
|
||
mainred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # Homebrew formula update job | ||
| update-formula: | ||
| name: Update Homebrew Formula | ||
| needs: [ mac-hash, linux-hash ] | ||
| runs-on: ubuntu-latest | ||
| if: ${{ !github.event.release.prerelease }} | ||
| env: | ||
| TAG_NAME: ${{ github.ref_name }} | ||
| steps: | ||
| - name: Checkout homebrew-holmesgpt repository | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| repository: robusta-dev/homebrew-holmesgpt | ||
| token: ${{ secrets.MULTIREPO_GITHUB_TOKEN }} | ||
| - name: Update holmesgpt.rb formula | ||
| run: | | ||
| MAC_BUILD_HASH=${{ needs.mac-hash.outputs.MAC_BUILD_HASH }} | ||
| LINUX_BUILD_HASH=${{ needs.linux-hash.outputs.LINUX_BUILD_HASH }} | ||
| awk 'NR==6{$0=" url \"https://github.com/robusta-dev/holmesgpt/releases/download/'"$TAG_NAME"'/holmes-macos-latest-'"$TAG_NAME"'.zip\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb | ||
| awk 'NR==7{$0=" sha256 \"'$MAC_BUILD_HASH'\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb | ||
| awk 'NR==9{$0=" url \"https://github.com/robusta-dev/holmesgpt/releases/download/'"$TAG_NAME"'/holmes-ubuntu-22.04-'"$TAG_NAME"'.zip\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb | ||
| awk 'NR==10{$0=" sha256 \"'$LINUX_BUILD_HASH'\""}1' ./Formula/holmesgpt.rb > temp && mv temp ./Formula/holmesgpt.rb | ||
mainred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Commit and push changes | ||
| run: | | ||
| git config --local user.email "[email protected]" | ||
| git config --local user.name "GitHub Action" | ||
| git commit -am "Update formula for release ${TAG_NAME}" | ||
| git push | ||
mainred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,81 +2,39 @@ | |
| # we test this on each commit/PR to catch build problems early | ||
| name: Build and test HolmesGPT | ||
|
|
||
| on: [push, pull_request, workflow_dispatch] | ||
| on: [ push, pull_request, workflow_dispatch ] | ||
|
|
||
| jobs: | ||
| # Pre-commit checks job | ||
| check: | ||
| name: Pre-commit checks | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| - name: Install Poetry | ||
| uses: snok/install-poetry@v1 | ||
| with: | ||
| virtualenvs-create: true | ||
| virtualenvs-in-project: true | ||
| virtualenvs-path: .venv | ||
| installer-parallel: true | ||
| - name: Install dependencies | ||
| run: poetry install --no-interaction --no-root | ||
| - uses: pre-commit/[email protected] | ||
| build: | ||
| needs: check | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12"] | ||
|
|
||
| runs-on: ubuntu-latest | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install Poetry | ||
| uses: snok/install-poetry@v1 | ||
| with: | ||
| virtualenvs-create: true | ||
| virtualenvs-in-project: true | ||
| virtualenvs-path: .venv | ||
| installer-parallel: true | ||
|
|
||
| - name: Install Python dependencies and build | ||
| # if you change something here, you must also change it in .github/workflows/build-binaries-and-brew.yaml | ||
| run: | | ||
| python -m pip install --upgrade pip setuptools pyinstaller | ||
| - name: Install dependencies | ||
| run: poetry install --no-interaction --no-root | ||
|
|
||
| curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 | ||
| poetry config virtualenvs.create false | ||
| poetry install --no-root | ||
| - uses: pre-commit/[email protected] | ||
|
|
||
| sudo apt-get install -y binutils | ||
| pyinstaller holmes_cli.py \ | ||
| --name holmes \ | ||
| --add-data 'holmes/plugins/runbooks/*:holmes/plugins/runbooks' \ | ||
| --add-data 'holmes/plugins/prompts/*:holmes/plugins/prompts' \ | ||
| --add-data 'holmes/plugins/toolsets/*:holmes/plugins/toolsets' \ | ||
| --add-data 'holmes/plugins/toolsets/coralogix*:holmes/plugins/toolsets/coralogix' \ | ||
| --add-data 'holmes/plugins/toolsets/grafana*:holmes/plugins/toolsets/grafana' \ | ||
| --add-data 'holmes/plugins/toolsets/internet*:holmes/plugins/toolsets/internet' \ | ||
| --add-data 'holmes/plugins/toolsets/opensearch*:holmes/plugins/toolsets/opensearch' \ | ||
| --add-data 'holmes/plugins/toolsets/prometheus*:holmes/plugins/toolsets/prometheus' \ | ||
| --hidden-import=tiktoken_ext.openai_public \ | ||
| --hidden-import=tiktoken_ext \ | ||
| --hiddenimport litellm.llms.tokenizers \ | ||
| --hiddenimport litellm.litellm_core_utils.tokenizers \ | ||
| --collect-data litellm | ||
| ls dist | ||
|
|
||
| - name: Run tests | ||
| shell: bash | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| run: | | ||
| poetry run pytest -m "not llm" | ||
|
|
||
| - name: Test the binary | ||
| shell: bash | ||
| run: | | ||
| dist/holmes/holmes version | ||
| if [ $? -ne 0 ]; then | ||
| echo "Binary test failed" | ||
| exit 1 | ||
| fi | ||
| echo "Binary test passed" | ||
| build-and-test: | ||
| needs: check | ||
| if: always() && (needs.check.result == 'success' || needs.check.result == 'skipped') | ||
| uses: ./.github/workflows/build-template.yaml | ||
| with: | ||
| python-versions-matrix: '["3.10", "3.11", "3.12"]' | ||
| os-matrix: '["ubuntu-latest", "windows-latest", "macos-latest"]' | ||
| is-release: false | ||
| secrets: inherit | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.