Fix cross-compilation issues and optimize release workflow
- Fix ARM64 cross-compilation with proper binutils - Use target-specific strip commands - Remove Windows/musl builds to reduce complexity - Add 60-minute timeout for builds - Optimize to 4 core platforms: Linux x86_64/ARM64, macOS Intel/ARM 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
36
.github/workflows/release.yml
vendored
36
.github/workflows/release.yml
vendored
@ -20,6 +20,7 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.target }}
|
name: Build ${{ matrix.target }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@ -27,10 +28,6 @@ jobs:
|
|||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
artifact_name: ailog
|
artifact_name: ailog
|
||||||
asset_name: ailog-linux-x86_64
|
asset_name: ailog-linux-x86_64
|
||||||
- target: x86_64-unknown-linux-musl
|
|
||||||
os: ubuntu-latest
|
|
||||||
artifact_name: ailog
|
|
||||||
asset_name: ailog-linux-x86_64-musl
|
|
||||||
- target: aarch64-unknown-linux-gnu
|
- target: aarch64-unknown-linux-gnu
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
artifact_name: ailog
|
artifact_name: ailog
|
||||||
@ -43,10 +40,6 @@ jobs:
|
|||||||
os: macos-latest
|
os: macos-latest
|
||||||
artifact_name: ailog
|
artifact_name: ailog
|
||||||
asset_name: ailog-macos-aarch64
|
asset_name: ailog-macos-aarch64
|
||||||
- target: x86_64-pc-windows-msvc
|
|
||||||
os: windows-latest
|
|
||||||
artifact_name: ailog.exe
|
|
||||||
asset_name: ailog-windows-x86_64.exe
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -57,16 +50,10 @@ jobs:
|
|||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Install cross-compilation tools (Linux)
|
- name: Install cross-compilation tools (Linux)
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y gcc-multilib
|
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
|
||||||
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
|
|
||||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
||||||
fi
|
|
||||||
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]]; then
|
|
||||||
sudo apt-get install -y musl-tools
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Configure cross-compilation (Linux ARM64)
|
- name: Configure cross-compilation (Linux ARM64)
|
||||||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||||||
@ -95,11 +82,17 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd target/${{ matrix.target }}/release
|
cd target/${{ matrix.target }}/release
|
||||||
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
|
|
||||||
strip ${{ matrix.artifact_name }} || true
|
# Use appropriate strip command for cross-compilation
|
||||||
|
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
|
||||||
|
aarch64-linux-gnu-strip ${{ matrix.artifact_name }} || echo "Strip failed, continuing..."
|
||||||
|
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
|
||||||
|
strip ${{ matrix.artifact_name }} || echo "Strip failed, continuing..."
|
||||||
else
|
else
|
||||||
strip ${{ matrix.artifact_name }}
|
strip ${{ matrix.artifact_name }} || echo "Strip failed, continuing..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create archive
|
||||||
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
|
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
|
||||||
7z a ../../../${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
|
7z a ../../../${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
|
||||||
else
|
else
|
||||||
@ -137,9 +130,8 @@ jobs:
|
|||||||
echo "- AI comment system" >> release_notes.md
|
echo "- AI comment system" >> release_notes.md
|
||||||
echo "" >> release_notes.md
|
echo "" >> release_notes.md
|
||||||
echo "### Platforms" >> release_notes.md
|
echo "### Platforms" >> release_notes.md
|
||||||
echo "- Linux (x86_64, aarch64, musl)" >> release_notes.md
|
echo "- Linux (x86_64, aarch64)" >> release_notes.md
|
||||||
echo "- macOS (Intel, Apple Silicon)" >> release_notes.md
|
echo "- macOS (Intel, Apple Silicon)" >> release_notes.md
|
||||||
echo "- Windows (x86_64)" >> release_notes.md
|
|
||||||
echo "" >> release_notes.md
|
echo "" >> release_notes.md
|
||||||
echo "### Installation" >> release_notes.md
|
echo "### Installation" >> release_notes.md
|
||||||
echo "\`\`\`bash" >> release_notes.md
|
echo "\`\`\`bash" >> release_notes.md
|
||||||
@ -148,8 +140,6 @@ jobs:
|
|||||||
echo "chmod +x ailog" >> release_notes.md
|
echo "chmod +x ailog" >> release_notes.md
|
||||||
echo "sudo mv ailog /usr/local/bin/" >> release_notes.md
|
echo "sudo mv ailog /usr/local/bin/" >> release_notes.md
|
||||||
echo "" >> release_notes.md
|
echo "" >> release_notes.md
|
||||||
echo "# Windows" >> release_notes.md
|
|
||||||
echo "# Extract ailog-windows-x86_64.zip and add to PATH" >> release_notes.md
|
|
||||||
echo "\`\`\`" >> release_notes.md
|
echo "\`\`\`" >> release_notes.md
|
||||||
|
|
||||||
- name: Get tag name
|
- name: Get tag name
|
||||||
|
56
action.yml
56
action.yml
@ -47,17 +47,57 @@ outputs:
|
|||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- name: Cache ailog binary
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
path: ./bin
|
||||||
override: true
|
key: ailog-bin-${{ runner.os }}
|
||||||
|
restore-keys: |
|
||||||
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Install ailog
|
- name: Check and update ailog binary
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ ! -f "./target/release/ailog" ]; then
|
# Get latest release version (for Gitea, adjust API endpoint if needed)
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
LATEST_VERSION=$(curl -s https://api.github.com/repos/syui/ailog/releases/latest | jq -r .tag_name 2>/dev/null || echo "v0.1.1")
|
||||||
|
else
|
||||||
|
LATEST_VERSION="v0.1.1" # fallback version
|
||||||
|
fi
|
||||||
|
echo "Target version: $LATEST_VERSION"
|
||||||
|
|
||||||
|
# Check current binary version if exists
|
||||||
|
mkdir -p ./bin
|
||||||
|
if [ -f "./bin/ailog" ]; then
|
||||||
|
CURRENT_VERSION=$(./bin/ailog --version | awk '{print $2}' 2>/dev/null || echo "unknown")
|
||||||
|
echo "Current version: $CURRENT_VERSION"
|
||||||
|
else
|
||||||
|
CURRENT_VERSION="none"
|
||||||
|
echo "No binary found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download if version is different or binary doesn't exist
|
||||||
|
if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then
|
||||||
|
echo "Downloading ailog $LATEST_VERSION..."
|
||||||
|
# Try GitHub first, then fallback to local build
|
||||||
|
if curl -sL https://github.com/syui/ailog/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf - 2>/dev/null; then
|
||||||
|
mv ailog ./bin/ailog
|
||||||
|
chmod +x ./bin/ailog
|
||||||
|
echo "Downloaded binary: $(./bin/ailog --version)"
|
||||||
|
else
|
||||||
|
echo "Download failed, building from source..."
|
||||||
|
if command -v cargo >/dev/null 2>&1; then
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
cp ./target/release/ailog ./bin/ailog
|
||||||
|
echo "Built from source: $(./bin/ailog --version)"
|
||||||
|
else
|
||||||
|
echo "Error: Neither download nor cargo build available"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Binary is up to date"
|
||||||
|
chmod +x ./bin/ailog
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Node.js for OAuth app
|
- name: Setup Node.js for OAuth app
|
||||||
@ -83,8 +123,8 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
|
|
||||||
./target/release/ailog generate \
|
./bin/ailog build \
|
||||||
--input ${{ inputs.content-dir }} \
|
--content ${{ inputs.content-dir }} \
|
||||||
--output ${{ inputs.output-dir }} \
|
--output ${{ inputs.output-dir }} \
|
||||||
--templates ${{ inputs.template-dir }} \
|
--templates ${{ inputs.template-dir }} \
|
||||||
--static ${{ inputs.static-dir }} \
|
--static ${{ inputs.static-dir }} \
|
||||||
|
Reference in New Issue
Block a user