Skip to content
This repository was archived by the owner on May 30, 2026. It is now read-only.

Refact Agent Engine CI Release (Rust) #7

Refact Agent Engine CI Release (Rust)

Refact Agent Engine CI Release (Rust) #7

name: Refact Agent Engine CI Release (Rust)
on:
workflow_dispatch:
push:
tags:
- engine/*
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
defaults:
run:
working-directory: refact-agent/engine
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
# RUSTFLAGS: "-D warnings -W unreachable-pub"
RUSTUP_MAX_RETRIES: 10
FETCH_DEPTH: 0 # pull in the tags for the version string
MACOSX_DEPLOYMENT_TARGET: 10.15
jobs:
dist:
strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
ext: .exe
- os: windows-latest
target: i686-pc-windows-msvc
code-target: win32-ia32
ext: .exe
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
ext: .exe
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
code-target: linux-x64
cross: true
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
cross: true
# - os: ubuntu-22.04
# target: arm-unknown-linux-gnueabihf
# code-target: linux-armhf
- os: macos-15-intel
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-14
target: aarch64-apple-darwin
code-target: darwin-arm64
env:
LLM_LS_TARGET: ${{ matrix.target }}
name: dist (${{ matrix.target }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }}
- name: Install Rust toolchain
run: |
rustup update --no-self-update stable
rustup target add ${{ matrix.target }}
rustup component add rust-src
- name: Install LLVM (Windows)
if: startsWith(matrix.os, 'windows')
run: choco install llvm -y
- name: Install LLVM (macOS)
if: startsWith(matrix.os, 'macos')
run: brew install llvm
- name: Add swap space (Linux cross-compilation needs extra RAM for LTO)
if: matrix.cross
run: |
sudo swapoff /swapfile 2>/dev/null || true
sudo rm -f /swapfile
sudo dd if=/dev/zero of=/swapfile bs=128M count=64
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
free -h
- name: Install ARM target toolchain
if: matrix.target == 'arm-unknown-linux-gnueabihf'
run: sudo apt-get install gcc-arm-linux-gnueabihf
- name: Restore cached cargo
uses: swatinem/rust-cache@v2
with:
workspaces: |
refact-agent/engine -> target
key: ${{ matrix.os }}-${{ matrix.target }}-cargo
shared-key: ${{ matrix.os }}-${{ matrix.target }}-cargo
- name: Install cross-rs
if: matrix.cross
uses: taiki-e/install-action@v2
with:
tool: cross
fallback: none
- name: Test artifact
if: matrix.cross == null && startsWith(matrix.os, 'windows')
run: cargo test --release --lib --tests || exit 1
- name: Build artifact
if: matrix.cross == null && startsWith(matrix.os, 'windows')
run: |
cargo build --release || exit 1
cp ./target/release/refact-lsp${{ matrix.ext }} ../..
- name: Test artifact
if: matrix.cross == null && !startsWith(matrix.os, 'windows')
run: OPENSSL_STATIC=1 cargo test --release --lib --tests --target ${{ matrix.target }} || exit 1
- name: Build artifact
if: matrix.cross == null && !startsWith(matrix.os, 'windows')
run: |
OPENSSL_STATIC=1 cargo build --release --target ${{ matrix.target }} || exit 1
cp ./target/${{ matrix.target }}/release/refact-lsp${{ matrix.ext }} ../..
- name: Test linux-like artifact
if: matrix.cross
env:
CARGO_BUILD_JOBS: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && '1' || '2' }}
CARGO_PROFILE_RELEASE_LTO: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'thin' || 'true' }}
run: CROSS_NO_WARNINGS=0 cross test --release --lib --tests --target ${{ matrix.target }} || exit 1
- name: Build linux-like artifact
if: matrix.cross
env:
CARGO_BUILD_JOBS: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && '1' || '2' }}
CARGO_PROFILE_RELEASE_LTO: ${{ matrix.target == 'aarch64-unknown-linux-gnu' && 'thin' || 'true' }}
run: |
CROSS_NO_WARNINGS=0 cross build --release --target ${{ matrix.target }} || exit 1
cp ./target/${{ matrix.target }}/release/refact-lsp${{ matrix.ext }} ../..
- name: Package artifact in ZIP (WIN)
uses: vimtor/action-zip@v1.2
if: endsWith(matrix.target, 'msvc')
with:
files: refact-lsp.exe
recursive: false
dest: dist-${{ matrix.target }}.zip
- name: Package artifact in ZIP (UNIX)
uses: vimtor/action-zip@v1.2
if: ${{ !endsWith(matrix.target, 'msvc') }}
with:
files: refact-lsp
recursive: false
dest: dist-${{ matrix.target }}.zip
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
asset_name: dist-${{ matrix.target }}
file: dist-${{ matrix.target }}.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true