diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b16674a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,142 @@ +name: Build Binaries + +on: + push: + branches: ['main'] + pull_request: + branches: ['main'] + workflow_dispatch: + +permissions: + contents: write + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-24.04 + name: linux + arch: amd64 + - os: windows-latest + name: windows + arch: amd64 + - os: macos-latest + name: macos + arch: arm64 + - os: macos-15-intel + name: macos + arch: amd64 + + steps: + - uses: actions/checkout@v4 + + - name: Build binary (Linux in Ubuntu 25.10 container) + if: matrix.name == 'linux' + shell: bash + run: | + # Docker container with Ubuntu 25.10 and build the binary inside it + rm -rf dist/* + docker run --rm \ + -v "$PWD:/workspace" \ + -w /workspace \ + ubuntu:25.10 \ + bash -c " + set -e + echo 'Setting up Ubuntu 25.10 build environment...' + + apt-get update -y + apt-get install -y curl python3 python3-pip python3-venv binutils + + # Install uv (Python package manager) + curl -LsSf https://astral.sh/uv/install.sh | sh + export PATH=\"\$HOME/.local/bin:\$PATH\" + + echo 'Building binary with uv...' + uv sync + uv run build.py + + echo 'Build completed. Checking output:' + ls -la dist/ + " + + - name: Setup uv for Windows/macOS + if: matrix.name != 'linux' + uses: astral-sh/setup-uv@v4 + + - name: Build binary (Windows/macOS native) + if: matrix.name != 'linux' + shell: bash + run: | + rm -rf dist/* + uv sync + uv run build.py + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: perfecto-mcp-${{ matrix.name }}-${{ matrix.arch }} + path: dist/ + + commit-artifacts: + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts/ + + - name: Organize artifacts into dist/ + shell: bash + run: | + mkdir -p dist/ + # Copy all binaries from artifact directories to dist/ + # upload-artifacts job does not preserve the executable permission + # so we need to set it manually: https://github.com/actions/download-artifact?tab=readme-ov-file#limitations + + if [ -d "artifacts/perfecto-mcp-linux-amd64" ]; then + cp artifacts/perfecto-mcp-linux-amd64/* dist/ + chmod +x dist/perfecto-mcp-linux-amd64 + echo "Copied Linux AMD64 binary" + fi + if [ -d "artifacts/perfecto-mcp-linux-arm64" ]; then + cp artifacts/perfecto-mcp-linux-arm64/* dist/ + chmod +x dist/perfecto-mcp-linux-arm64 + echo "Copied Linux ARM64 binary" + fi + if [ -d "artifacts/perfecto-mcp-windows-amd64" ]; then + cp artifacts/perfecto-mcp-windows-amd64/* dist/ + echo "Copied Windows AMD64 binary" + fi + if [ -d "artifacts/perfecto-mcp-macos-arm64" ]; then + cp artifacts/perfecto-mcp-macos-arm64/* dist/ + chmod +x dist/perfecto-mcp-macos-arm64 + echo "Copied macOS ARM64 binary" + fi + if [ -d "artifacts/perfecto-mcp-macos-amd64" ]; then + cp artifacts/perfecto-mcp-macos-amd64/* dist/ + chmod +x dist/perfecto-mcp-macos-amd64 + echo "Copied macOS AMD64 binary" + fi + + echo "Final dist/ contents:" + ls -la dist/ || echo "No dist/ directory found" + + - name: Commit all artifacts to repository + shell: bash + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + git add dist/ + if git diff --staged --quiet; then + echo "No changes to commit" + else + git commit -m "[skip ci] Update all binary artifacts" + git push + fi + diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 644bdfc..babd4dc 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -4,7 +4,7 @@ on: workflow_run: workflows: ["Build Binaries"] types: [completed] - branches: [main, GITHUB_ACTIONS] + branches: [main] release: types: [published] workflow_dispatch: @@ -33,7 +33,7 @@ jobs: uses: dawidd6/action-download-artifact@v6 with: github_token: ${{ secrets.GITHUB_TOKEN }} - workflow: build.yaml + workflow: build.yml run_id: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'release') && '' || github.event.workflow_run.id }} name_is_regexp: true name: perfecto-mcp-.* diff --git a/.gitignore b/.gitignore index 226f363..a5a2697 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ __pycache__/ perfecto_mcp.egg-info/ *.py[oc] build/ -dist/ wheels/ *.egg-info diff --git a/build.py b/build.py index bf51f4a..1d27f88 100644 --- a/build.py +++ b/build.py @@ -80,7 +80,8 @@ def build(): 'main.py', '--onefile', '--version-file=version_info.txt', - f'--add-data=pyproject.toml{sep}app.png{sep}.', + f'--add-data=pyproject.toml{sep}.', + f'--add-data=resources/app.png{sep}resources', f'--name={name}', f'--icon={icon}', '--clean', diff --git a/dist/perfecto-mcp-linux-amd64 b/dist/perfecto-mcp-linux-amd64 new file mode 100755 index 0000000..2374611 Binary files /dev/null and b/dist/perfecto-mcp-linux-amd64 differ diff --git a/dist/perfecto-mcp-macos-amd64 b/dist/perfecto-mcp-macos-amd64 new file mode 100755 index 0000000..2e52c68 Binary files /dev/null and b/dist/perfecto-mcp-macos-amd64 differ diff --git a/dist/perfecto-mcp-macos-arm64 b/dist/perfecto-mcp-macos-arm64 new file mode 100755 index 0000000..3ad9465 Binary files /dev/null and b/dist/perfecto-mcp-macos-arm64 differ diff --git a/dist/perfecto-mcp-windows-amd64.exe b/dist/perfecto-mcp-windows-amd64.exe new file mode 100644 index 0000000..9106b43 Binary files /dev/null and b/dist/perfecto-mcp-windows-amd64.exe differ