Skip to content

Commit 38c2fa5

Browse files
feat(distribution): release infra
1 parent 48447aa commit 38c2fa5

12 files changed

Lines changed: 1155 additions & 314 deletions

File tree

.github/workflows/release.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-natives:
10+
name: Build ${{ matrix.package }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
# macOS
17+
- os: macos-14
18+
arch: arm64
19+
gpu: metal
20+
package: darwin-arm64
21+
- os: macos-13
22+
arch: x64
23+
gpu: cpu
24+
package: darwin-x64
25+
26+
# Linux
27+
- os: ubuntu-22.04
28+
arch: x64
29+
gpu: cpu
30+
package: linux-x64
31+
- os: ubuntu-22.04
32+
arch: x64
33+
gpu: cuda
34+
package: linux-x64-cuda
35+
- os: ubuntu-22.04
36+
arch: x64
37+
gpu: vulkan
38+
package: linux-x64-vulkan
39+
40+
# Windows
41+
- os: windows-2022
42+
arch: x64
43+
gpu: cpu
44+
package: win32-x64
45+
- os: windows-2022
46+
arch: x64
47+
gpu: cuda
48+
cuda_version: 12.2.0
49+
package: win32-x64-cuda
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
with:
55+
submodules: recursive
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 20
61+
registry-url: 'https://registry.npmjs.org'
62+
63+
# Platform-specific dependencies
64+
- name: Install build tools (Linux)
65+
if: runner.os == 'Linux' && matrix.gpu == 'cpu'
66+
run: |
67+
sudo apt-get update
68+
sudo apt-get install -y build-essential cmake
69+
70+
- name: Install CUDA toolkit (Linux)
71+
if: matrix.gpu == 'cuda' && runner.os == 'Linux'
72+
run: |
73+
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
74+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
75+
sudo apt-get update
76+
sudo apt-get install -y cuda-toolkit-12-2 build-essential cmake
77+
78+
- name: Install Vulkan SDK (Linux)
79+
if: matrix.gpu == 'vulkan' && runner.os == 'Linux'
80+
run: |
81+
sudo apt-get update
82+
sudo apt-get install -y build-essential cmake libvulkan-dev vulkan-tools
83+
84+
- name: Install CUDA toolkit (Windows)
85+
if: matrix.gpu == 'cuda' && runner.os == 'Windows'
86+
uses: Jimver/cuda-toolkit@v0.2.11
87+
with:
88+
cuda: '12.2.0'
89+
90+
# Build
91+
- name: Install npm dependencies
92+
run: npm install
93+
94+
- name: Build native module
95+
run: npm run build
96+
env:
97+
LLOYAL_GPU: ${{ matrix.gpu }}
98+
99+
# Package
100+
- name: Create platform package
101+
shell: bash
102+
run: |
103+
PKG_NAME="${{ matrix.package }}"
104+
node scripts/create-platform-package.js "$PKG_NAME" "${{ matrix.os }}" "${{ matrix.arch }}"
105+
106+
# Publish
107+
- name: Publish platform package
108+
working-directory: packages/${{ matrix.package }}
109+
run: npm publish --access public
110+
env:
111+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
112+
113+
publish-main:
114+
name: Publish main package
115+
needs: build-natives
116+
runs-on: ubuntu-latest
117+
118+
steps:
119+
- name: Checkout code
120+
uses: actions/checkout@v4
121+
122+
- name: Setup Node.js
123+
uses: actions/setup-node@v4
124+
with:
125+
node-version: 20
126+
registry-url: 'https://registry.npmjs.org'
127+
128+
- name: Sync package versions
129+
run: node scripts/sync-versions.js
130+
131+
- name: Publish main package
132+
run: npm publish
133+
env:
134+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Build artifacts (generated during install)
2+
build/
3+
include/
4+
*.node
5+
*.dylib
6+
*.so
7+
*.dll
8+
9+
# llama.cpp build directories
10+
llama.cpp/build-*
11+
vendor/llama.cpp/build-*
12+
liblloyal/build/
13+
14+
# Git metadata (vendored sources used instead of submodules)
15+
.git
16+
.gitmodules
17+
.gitignore
18+
19+
# Development dependencies and configs
20+
package-lock.json
21+
node_modules/
22+
.vscode/
23+
.idea/
24+
*.log
25+
.DS_Store
26+
27+
# Development files
28+
test/
29+
tests/
30+
*.test.js
31+
examples/
32+
docs/
33+
34+
# CI/CD (runs from git checkout, not needed in published package)
35+
.github/
36+
37+
# Markdown files (except README and CHANGELOG which npm includes by default)
38+
*.md
39+
!README.md
40+
!CHANGELOG.md
41+
42+
# Platform packages (generated during CI, not distributed with source)
43+
packages/darwin-*
44+
packages/linux-*
45+
packages/win32-*
46+
packages/template/
47+
48+
# Temporary files
49+
*.tgz
50+
*.tar.gz
51+
*.tmp

0 commit comments

Comments
 (0)