This repository was archived by the owner on May 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 319
182 lines (159 loc) · 5.86 KB
/
Copy pathagent_engine_build.yml
File metadata and controls
182 lines (159 loc) · 5.86 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
name: Refact Agent Engine CI build (Rust)
on:
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g. for dependabot pull requests)
push:
branches: [main, dev]
paths:
- "refact-agent/engine/**"
- ".github/workflows/agent_engine_*"
workflow_call:
# Trigger the workflow on any pull request
pull_request:
paths:
- "refact-agent/engine/**"
- ".github/workflows/agent_engine_*"
workflow_dispatch:
repository_dispatch:
# workflow_run:
# workflows: ["Cache cleanup"]
# types:
# - completed
concurrency:
group: agent-engine-build-${{ github.run_id }}
cancel-in-progress: false
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-large
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 }}
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: Install build tools
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y clang mold lld
- 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
cache-bin: false
- 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 --workspace --profile ci-release --lib --tests || exit 1
- name: Build artifact
if: matrix.cross == null && startsWith(matrix.os, 'windows')
run: |
cargo build --workspace --profile ci-release || exit 1
cp ./target/ci-release/refact-lsp${{ matrix.ext }} ../..
- name: Test artifact
if: matrix.cross == null && !startsWith(matrix.os, 'windows')
env:
CARGO_PROFILE_CI_RELEASE_LTO: ${{ endsWith(matrix.target, 'apple-darwin') && 'thin' || 'true' }}
run: OPENSSL_STATIC=1 cargo test --workspace --profile ci-release --lib --tests --target ${{ matrix.target }} || exit 1
- name: Build artifact
if: matrix.cross == null && !startsWith(matrix.os, 'windows')
env:
CARGO_PROFILE_CI_RELEASE_LTO: ${{ endsWith(matrix.target, 'apple-darwin') && 'thin' || 'true' }}
run: |
OPENSSL_STATIC=1 cargo build --workspace --profile ci-release --target ${{ matrix.target }} || exit 1
cp ./target/${{ matrix.target }}/ci-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' }}
run: CROSS_NO_WARNINGS=0 cross test --workspace --profile ci-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' }}
run: |
CROSS_NO_WARNINGS=0 cross build --workspace --profile ci-release --target ${{ matrix.target }} || exit 1
cp ./target/${{ matrix.target }}/ci-release/refact-lsp${{ matrix.ext }} ../..
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.target }}
if-no-files-found: ignore
path: |
refact-lsp
refact-lsp.exe