-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathcli-build-binary-and-optionally-release.yml
More file actions
133 lines (116 loc) · 4.64 KB
/
cli-build-binary-and-optionally-release.yml
File metadata and controls
133 lines (116 loc) · 4.64 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
# Workflow that builds and tests the CLI binary executable
name: CLI - Build binary and optionally release
# Run on pushes to main branch and CLI tags, and on pull requests when CLI files change
on:
push:
branches: [main]
tags:
- '*'
pull_request:
branches: ['**']
permissions:
contents: write # needed to create releases or upload assets
# Cancel previous runs if a new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ (github.head_ref && github.ref) || github.run_id }}
cancel-in-progress: true
jobs:
build-binary:
name: Build binary executable
strategy:
matrix:
include:
# Build on Ubuntu 22.04 x86_64 for maximum GLIBC compatibility (GLIBC 2.31)
- os: ubuntu-22.04
platform: linux
artifact_name: openhands-cli-linux-x86_64
# Build on Ubuntu 22.04 ARM64
- os: ubuntu-22.04-arm
platform: linux
artifact_name: openhands-cli-linux-arm64
# Build on macOS for macOS users
- os: macos-15
platform: macos
artifact_name: openhands-cli-macos-arm64
# Build on macOS Intel
- os: macos-15-intel
platform: macos
artifact_name: openhands-cli-macos-intel
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: latest
- name: Install dependencies
run: |
uv sync
- name: Build binary executable
run: |
./build.sh --install-pyinstaller | tee output.log
echo "Full output:"
cat output.log
if grep -q "❌" output.log; then
echo "❌ Found failure marker in output"
exit 1
fi
echo "✅ Build & test finished without ❌ markers"
- name: Verify binary files exist
run: |
if ! ls dist/openhands* 1> /dev/null 2>&1; then
echo "❌ No binaries found to upload!"
exit 1
fi
echo "✅ Found binaries to upload."
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: dist/openhands*
retention-days: 30
create-github-release:
name: Create GitHub Release
runs-on: ubuntu-24.04
needs: build-binary
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release-assets
# Copy binaries with appropriate names for release
if [ -f artifacts/openhands-cli-linux-x86_64/openhands ]; then
cp artifacts/openhands-cli-linux-x86_64/openhands release-assets/openhands-linux-x86_64
fi
if [ -f artifacts/openhands-cli-linux-arm64/openhands ]; then
cp artifacts/openhands-cli-linux-arm64/openhands release-assets/openhands-linux-arm64
fi
if [ -f artifacts/openhands-cli-macos-arm64/openhands ]; then
cp artifacts/openhands-cli-macos-arm64/openhands release-assets/openhands-macos-arm64
fi
if [ -f artifacts/openhands-cli-macos-intel/openhands ]; then
cp artifacts/openhands-cli-macos-intel/openhands release-assets/openhands-macos-intel
fi
ls -la release-assets/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release-assets/*
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}