-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
node-addon-api (n-api) instead NAN (#14)
* Remove inherits & safe-buffer * Add hooks via husky * Add clang-format * Make code more es6 * Update dev dependencies * Use n-api instead nan * Update years in LICENSE file * Remove appveyor and travis * Remove husky * Use prebuildify instead node-gyp * Add lint workflow for GH Actions * Add test workflow for GH Actions * Build package for publishing in GitHub Actions * Adjust README
- Loading branch information
Showing
29 changed files
with
602 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
--- | ||
Language: Cpp | ||
# BasedOnStyle: Google | ||
AccessModifierOffset: -1 | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: false | ||
AlignConsecutiveDeclarations: false | ||
AlignEscapedNewlines: Right | ||
AlignOperands: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortIfStatementsOnASingleLine: true | ||
AllowShortLoopsOnASingleLine: true | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterClass: false | ||
AfterControlStatement: false | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
SplitEmptyNamespace: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Attach | ||
BreakBeforeInheritanceComma: false | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: BeforeColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 80 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^<ext/.*\.h>' | ||
Priority: 2 | ||
- Regex: '^<.*\.h>' | ||
Priority: 1 | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 3 | ||
IncludeIsMainRegex: '([-_](test|unittest))?$' | ||
IndentCaseLabels: true | ||
IndentPPDirectives: None | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBlockIndentWidth: 2 | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerAlignment: Left | ||
ReflowComments: true | ||
SortIncludes: true | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterTemplateKeyword: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInContainerLiterals: true | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
Standard: Auto | ||
TabWidth: 8 | ||
UseTab: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Build addon, run tests and package | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build-and-test: | ||
name: Build addon | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- macos-latest | ||
- ubuntu-latest | ||
- windows-latest | ||
steps: | ||
- name: Fetch code | ||
uses: actions/checkout@v1 | ||
with: | ||
submodules: true | ||
|
||
- name: Install dependencies | ||
run: yarn install --ignore-scripts | ||
|
||
- name: Build addon | ||
run: make build-addon | ||
|
||
- name: Get minimal Node.js version from package.json (Linux & macOS) | ||
id: node-version-nix | ||
if: runner.os != 'Windows' | ||
run: echo "::set-output name=version::$(node -p 'require("./package.json").engines.node.match(/(\d.*)$/)[0]')" | ||
|
||
- name: Use Node.js ${{ steps.node-version-nix.outputs.version }} (Linux & macOS) | ||
if: runner.os != 'Windows' | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ steps.node-version-nix.outputs.version }} | ||
|
||
- name: Get minimal Node.js version from package.json (Windows) | ||
id: node-version-win | ||
if: runner.os == 'Windows' | ||
run: echo "::set-output name=version::$(node -p 'require(\"./package.json\").engines.node.match(/(\d.*)$/)[0]')" | ||
|
||
- name: Use Node.js ${{ steps.node-version-win.outputs.version }} (Windows) | ||
if: runner.os == 'Windows' | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ steps.node-version-win.outputs.version }} | ||
|
||
- name: Run tests for addon | ||
run: make test-tap | ||
|
||
- name: Upload prebuilds | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: addon-${{ runner.os }} | ||
path: prebuilds | ||
|
||
package: | ||
name: Build package | ||
needs: build-and-test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch code | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install dependencies | ||
run: yarn install --ignore-scripts | ||
|
||
- name: Download macOS addon | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: addon-macOS | ||
|
||
- name: Download Linux addon | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: addon-Linux | ||
|
||
- name: Download Windows addon | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: addon-Windows | ||
|
||
- name: Move addons to one folder | ||
run: mkdir prebuilds && mv ./addon-*/* ./prebuilds/ | ||
|
||
- name: list | ||
run: find prebuilds | ||
|
||
- name: Build package | ||
run: make package | ||
|
||
- name: Get package version from package.json | ||
id: pkg-version | ||
run: echo "::set-output name=version::$(node -p 'require("./package.json").version')" | ||
|
||
- name: Upload package | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: package | ||
path: keccak-${{ steps.pkg-version.outputs.version }}.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Lint C/C++ and JS code | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
cpp: | ||
name: Lint C/C++ code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch code | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- uses: actions/cache@v1 | ||
id: cache | ||
with: | ||
path: clang | ||
key: clang-llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04 | ||
|
||
- name: Download clang-format | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: wget -O- -q http://releases.llvm.org/9.0.0/$VER.tar.xz | tar xfJ - $VER/bin/clang-format && mv $VER clang | ||
env: | ||
VER: clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04 | ||
|
||
- name: Run lint command | ||
run: PATH=$PATH:./clang/bin/ make lint-cpp-ci | ||
|
||
js: | ||
name: Lint JS code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch code | ||
uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install dependencies | ||
run: yarn install --ignore-scripts | ||
|
||
- name: Run lint command | ||
run: make lint-js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
coverage | ||
build | ||
node_modules | ||
prebuilds | ||
|
||
npm-debug.log | ||
package-lock.json | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.