Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #25 from Atome-FE/feature/ci
Browse files Browse the repository at this point in the history
fix: ci cross compile failure report
  • Loading branch information
hlhr202 authored Apr 23, 2023
2 parents 329a4f7 + 8462a18 commit 2fb88db
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 258 deletions.
1 change: 0 additions & 1 deletion .github/workflows/llama-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
branches:
- main
- develop
- 18-zsh-illegal-hardware-instruction
pull_request:
branches:
- master
Expand Down
171 changes: 112 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,17 @@
"@types/semver": "^7.3.13",
"axios": "*",
"glob": "^9.3.4",
"langchain": "^0.0.56",
"rimraf": "^4.4.1",
"semver": "^7.3.8",
"tsup": "^6.7.0",
"tsx": "^3.12.6",
"typescript": "^5.0.4",
"vitest": "^0.29.8",
"langchain": "^0.0.56"
"vitest": "^0.29.8"
},
"dependencies": {
"@llama-node/cli": "0.0.29"
"@llama-node/cli": "0.0.29",
"p-all": "^5.0.0"
},
"optionalDependencies": {
"@llama-node/core": "0.0.29",
Expand All @@ -69,4 +70,4 @@
"@llama-node/core": "0.0.29",
"@llama-node/llama-cpp": "0.0.29"
}
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"scripts": {
"prepublish": "npm run artifacts",
"cross-compile": "rimraf @llama-node && tsx scripts/cross-compile.ts",
"cross-compile": "rimraf @llama-node && tsx scripts/cross-compile.mts",
"artifacts": "tsx scripts/artifacts.ts",
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
Expand Down
35 changes: 0 additions & 35 deletions packages/core/scripts/artifacts.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { exec } from "child_process";
import pAll from "p-all";

const getTargets = () => {
switch (process.platform) {
Expand All @@ -16,15 +17,33 @@ const getTargets = () => {
}
};

const compile = () => {
const compile = async () => {
const targets = getTargets();
targets.forEach((target) => {
const promises = targets.map((target) => {
const buildProcess = exec(
`rustup target add ${target} && napi build --platform --target ${target} --release`
);
buildProcess.stdout?.pipe(process.stdout);
buildProcess.stderr?.pipe(process.stderr);

return () =>
new Promise<boolean>((resolve, reject) => {
buildProcess.on("close", (code) => {
if (code !== 0) {
reject(code);
} else {
resolve(true);
}
});
});
});

try {
await pAll(promises, { concurrency: 1 });
} catch (error) {
console.error(error);
process.exit(1);
}
};

compile();
Loading

0 comments on commit 2fb88db

Please sign in to comment.