Skip to content

Commit

Permalink
chore: review local build handling
Browse files Browse the repository at this point in the history
  • Loading branch information
b-ma committed Dec 26, 2024
1 parent 9a5a9db commit 61f7e9b
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 333 deletions.
9 changes: 3 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
indent_size = 2

[*.mjs]
indent_size = 2
[*.rs]
indent_size = 4

[*.md]
trim_trailing_whitespace = false
42 changes: 0 additions & 42 deletions .scripts/BUILD_NOTES.md

This file was deleted.

106 changes: 0 additions & 106 deletions .scripts/build-linux-arm32-rpi.mjs

This file was deleted.

107 changes: 0 additions & 107 deletions .scripts/build-linux-arm64-rpi.mjs

This file was deleted.

23 changes: 0 additions & 23 deletions .scripts/build-linux-gnu-docker.mjs

This file was deleted.

34 changes: 0 additions & 34 deletions .scripts/docker_x86_64-unknown-linux-gnu/Dockerfile

This file was deleted.

45 changes: 45 additions & 0 deletions .scripts/move-artifact.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import fs from 'node:fs';
import path from 'node:path';

const { platform } = process;
const profile = process.argv.includes('--release') ? 'release' : 'debug';

const pkg = fs.readFileSync(path.join('package.json'));
const PROJECT_NAME = JSON.parse(pkg).name;
const CARGO_BUILD_NAME = PROJECT_NAME.replace(/-/g, '_');

let buildPrefix = '';
let buildSuffix = '';

switch (platform) {
case 'win32':
buildPrefix = '';
buildSuffix = '.dll';
break;
case 'darwin':
buildPrefix = 'lib';
buildSuffix = '.dylib';
break;
default: // let's hope all linux like have same prefix and suffix...
buildPrefix = 'lib';
buildSuffix = '.so';
break;
}

const destReleaseFile = `${PROJECT_NAME}.build-release.node`;
const destDebugFile = `${PROJECT_NAME}.build-debug.node`;

if (fs.existsSync(destReleaseFile)) {
fs.rmSync(destReleaseFile, { force: true });
}

if (fs.existsSync(destDebugFile)) {
fs.rmSync(destDebugFile, { force: true });
}

let srcFile = path.join('target', profile, `${buildPrefix}${CARGO_BUILD_NAME}${buildSuffix}`);
let destFile = profile === 'release' ? destReleaseFile : destDebugFile;

console.log(`> move artifact "${srcFile}" to "${destFile}"`);

fs.copyFileSync(srcFile, destFile);
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const repo = process.env.REPO_NAME;
const ghToken = process.env.GITHUB_TOKEN;

const workflowName = 'matrix-build';
const numArtifacts = 1; // 2 Mac, 2 windows
const numArtifacts = 7; // 2 Mac, 2 windows, 3 linux
// need a key for downloading job artifacts
const octokit = new Octokit({ auth: ghToken });

Expand Down
Loading

0 comments on commit 61f7e9b

Please sign in to comment.