Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 55 additions & 15 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,69 @@ jobs:
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Building version: ${VERSION}"

- name: Build scorex for Linux (x86_64)
run: VERSION=${{ steps.version.outputs.VERSION }} bazel build //scorex:scorex_linux_amd64
- name: Build scorex for all platforms
run: |
VERSION=${{ steps.version.outputs.VERSION }} bazel build \
//scorex:scorex_linux_amd64 \
//scorex:scorex_darwin_arm64 \
//scorex:scorex_windows_amd64

- name: Copy Linux binary
- name: Copy binaries to artifacts
run: |
mkdir -p artifacts
cp bazel-bin/scorex/scorex_linux_amd64_/scorex_linux_amd64 artifacts/scorex-linux-x86_64

- name: Build scorex for macOS (Apple Silicon)
run: VERSION=${{ steps.version.outputs.VERSION }} bazel build //scorex:scorex_darwin_arm64
# Use bazel cquery to find actual output paths (bazel-bin symlink is cleared for multi-platform builds)
echo "Finding binary locations..."
LINUX_BIN=$(bazel cquery --output=files //scorex:scorex_linux_amd64 2>/dev/null)
DARWIN_ARM64_BIN=$(bazel cquery --output=files //scorex:scorex_darwin_arm64 2>/dev/null)
WINDOWS_BIN=$(bazel cquery --output=files //scorex:scorex_windows_amd64 2>/dev/null)

echo "Linux binary: $LINUX_BIN"
echo "macOS ARM64 binary: $DARWIN_ARM64_BIN"
echo "Windows binary: $WINDOWS_BIN"

# Copy binaries
if [ -f "$LINUX_BIN" ]; then
cp "$LINUX_BIN" artifacts/scorex-linux-x86_64
echo "✓ Linux binary copied"
else
echo "ERROR: Linux binary not found at $LINUX_BIN"
exit 1
fi

if [ -f "$DARWIN_ARM64_BIN" ]; then
cp "$DARWIN_ARM64_BIN" artifacts/scorex-macos-arm64
echo "✓ macOS ARM64 binary copied"
else
echo "ERROR: macOS ARM64 binary not found"
exit 1
fi

- name: Copy macOS binary
run: cp bazel-bin/scorex/scorex_darwin_arm64_/scorex_darwin_arm64 artifacts/scorex-macos-arm64
if [ -f "$WINDOWS_BIN" ]; then
cp "$WINDOWS_BIN" artifacts/scorex-windows-x86_64.exe
echo "✓ Windows binary copied"
else
echo "ERROR: Windows binary not found"
exit 1
fi

- name: Build scorex for Windows (x86_64)
run: VERSION=${{ steps.version.outputs.VERSION }} bazel build //scorex:scorex_windows_amd64
- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: scorex-linux
path: artifacts/scorex-linux-x86_64
if-no-files-found: error

- name: Copy Windows binary
run: cp bazel-bin/scorex/scorex_windows_amd64_/scorex_windows_amd64.exe artifacts/scorex-windows-x86_64.exe
- name: Upload macOS artifacts
uses: actions/upload-artifact@v4
with:
name: scorex-macos
path: artifacts/scorex-macos-arm64
if-no-files-found: error

- name: Upload CLI artifacts
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: scorex-cli-${{ steps.version.outputs.VERSION }}
path: artifacts/
name: scorex-windows
path: artifacts/scorex-windows-x86_64.exe
if-no-files-found: error
138 changes: 122 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to use for test release (e.g., 0.1.0-test)'
required: false
default: '0.0.0-test'
pull_request:
types: [opened, reopened, synchronize]
paths:
- 'scorex/**'
- '.github/workflows/release.yml'

jobs:
build-and-release:
Expand All @@ -39,30 +50,96 @@ jobs:
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
if [ "${{ github.event_name }}" == "push" ] && [ -n "${{ github.ref }}" ]; then
# Release from tag
VERSION=${GITHUB_REF#refs/tags/v}
TAG=${GITHUB_REF#refs/tags/}
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# Manual test release
VERSION="${{ github.event.inputs.version }}"
TAG="test-${VERSION}"
else
# PR test release
SHORT_SHA=$(git rev-parse --short HEAD)
VERSION="pr-${{ github.event.pull_request.number }}-${SHORT_SHA}"
TAG="test-${VERSION}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "TAG=${TAG}" >> $GITHUB_OUTPUT
echo "Building version: ${VERSION}"

- name: Build scorex for Linux (x86_64)
run: VERSION=${{ steps.version.outputs.VERSION }} bazel build //scorex:scorex_linux_amd64

- name: Build scorex for macOS (Apple Silicon)
run: VERSION=${{ steps.version.outputs.VERSION }} bazel build //scorex:scorex_darwin_arm64

- name: Build scorex for macOS (Intel)
run: VERSION=${{ steps.version.outputs.VERSION }} bazel build //scorex:scorex_darwin_amd64
- name: Build scorex for all platforms
run: |
echo "Current directory: $(pwd)"
echo "Building all platforms..."
VERSION=${{ steps.version.outputs.VERSION }} bazel build \
//scorex:scorex_linux_amd64 \
//scorex:scorex_darwin_arm64 \
//scorex:scorex_darwin_amd64 \
//scorex:scorex_windows_amd64
echo "Build complete. Exit code: $?"

- name: Build scorex for Windows (x86_64)
run: VERSION=${{ steps.version.outputs.VERSION }} bazel build //scorex:scorex_windows_amd64
- name: Debug bazel output
run: |
echo "=== Current directory ==="
pwd
echo "=== Listing current directory ==="
ls -la
echo "=== Checking for bazel-bin symlink ==="
ls -la | grep bazel || echo "No bazel symlinks found"
echo "=== Searching for bazel output ==="
find . -type d -name "bazel-bin" 2>/dev/null || echo "bazel-bin directory not found"
echo "=== Searching for scorex binaries ==="
find . -name "scorex_linux_amd64" -type f 2>/dev/null || echo "No Linux binary found"

- name: Prepare release artifacts
run: |
mkdir -p release
cp bazel-bin/scorex/scorex_linux_amd64_/scorex_linux_amd64 release/scorex-linux-x86_64
cp bazel-bin/scorex/scorex_darwin_arm64_/scorex_darwin_arm64 release/scorex-macos-arm64
cp bazel-bin/scorex/scorex_darwin_amd64_/scorex_darwin_amd64 release/scorex-macos-x86_64
cp bazel-bin/scorex/scorex_windows_amd64_/scorex_windows_amd64.exe release/scorex-windows-x86_64.exe

# Use bazel cquery to find actual output paths (bazel-bin symlink is cleared for multi-platform builds)
echo "Finding binary locations..."
LINUX_BIN=$(bazel cquery --output=files //scorex:scorex_linux_amd64 2>/dev/null)
DARWIN_ARM64_BIN=$(bazel cquery --output=files //scorex:scorex_darwin_arm64 2>/dev/null)
DARWIN_AMD64_BIN=$(bazel cquery --output=files //scorex:scorex_darwin_amd64 2>/dev/null)
WINDOWS_BIN=$(bazel cquery --output=files //scorex:scorex_windows_amd64 2>/dev/null)

echo "Linux binary: $LINUX_BIN"
echo "macOS ARM64 binary: $DARWIN_ARM64_BIN"
echo "macOS AMD64 binary: $DARWIN_AMD64_BIN"
echo "Windows binary: $WINDOWS_BIN"

# Copy binaries
if [ -f "$LINUX_BIN" ]; then
cp "$LINUX_BIN" release/scorex-linux-x86_64
echo "✓ Linux binary copied"
else
echo "ERROR: Linux binary not found at $LINUX_BIN"
exit 1
fi

if [ -f "$DARWIN_ARM64_BIN" ]; then
cp "$DARWIN_ARM64_BIN" release/scorex-macos-arm64
echo "✓ macOS ARM64 binary copied"
else
echo "ERROR: macOS ARM64 binary not found"
exit 1
fi

if [ -f "$DARWIN_AMD64_BIN" ]; then
cp "$DARWIN_AMD64_BIN" release/scorex-macos-x86_64
echo "✓ macOS AMD64 binary copied"
else
echo "ERROR: macOS AMD64 binary not found"
exit 1
fi

if [ -f "$WINDOWS_BIN" ]; then
cp "$WINDOWS_BIN" release/scorex-windows-x86_64.exe
echo "✓ Windows binary copied"
else
echo "ERROR: Windows binary not found"
exit 1
fi

# Create compressed archives
cd release
Expand All @@ -75,6 +152,8 @@ jobs:
sha256sum *.tar.gz *.zip > checksums.txt

- name: Create Release
# Only create actual release on tag push
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
Expand All @@ -86,3 +165,30 @@ jobs:
generate_release_notes: true
draft: false
prerelease: false

- name: Upload Linux artifacts
# Upload artifacts for PRs and manual runs
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: scorex-linux
path: release/scorex-${{ steps.version.outputs.VERSION }}-linux-x86_64.tar.gz
retention-days: 7

- name: Upload macOS artifacts
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: scorex-macos
path: |
release/scorex-${{ steps.version.outputs.VERSION }}-macos-arm64.tar.gz
release/scorex-${{ steps.version.outputs.VERSION }}-macos-x86_64.tar.gz
retention-days: 7

- name: Upload Windows artifacts
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: scorex-windows
path: release/scorex-${{ steps.version.outputs.VERSION }}-windows-x86_64.zip
retention-days: 7
Loading
Loading