Skip to content

Commit

Permalink
Update module and example
Browse files Browse the repository at this point in the history
  • Loading branch information
raub committed Oct 29, 2023
1 parent d243632 commit 1637b63
Show file tree
Hide file tree
Showing 41 changed files with 2,991 additions and 2,316 deletions.
116 changes: 0 additions & 116 deletions .eslintrc

This file was deleted.

81 changes: 81 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"ignorePatterns": [
"src/**"
],
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"parserOptions": {
"ecmaVersion": 2022
},
"env": {
"node": true,
"es6": true
},
"rules": {
"arrow-parens": ["error", "always"],
"no-trailing-spaces": [
"error",
{
"skipBlankLines": true
}
],
"indent": [
"error",
"tab",
{
"SwitchCase": 1
}
],
"operator-linebreak": [
"error",
"after",
{
"overrides": {
"?": "before",
":": "before"
}
}
],
"max-len": ["error", 110],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-multiple-empty-lines": ["error", { "max": 3, "maxEOF": 1, "maxBOF": 1 }],
"keyword-spacing": ["error", { "before": true, "after": true }],
"space-before-blocks": ["error"],
"space-before-function-paren": ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}],
"camelcase": ["error"],
"no-tabs": [0],
"global-require": [0],
"no-underscore-dangle": [0],
"no-plusplus": [0],
"no-shadow": [0],
"node/no-unpublished-require": [0],
"no-process-exit": [0],
"linebreak-style": [0],
"node/no-missing-require": [0],
"no-console": [0],
"node/no-unsupported-features/es-builtins": [
"error",
{ "version": ">=18.16.0" }
],
"node/no-unsupported-features/node-builtins": [
"error",
{ "version": ">=18.16.0" }
],
"func-names": [
"error",
"never",
{
"generators": "never"
}
]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/binding.gyp linguist-vendored
89 changes: 89 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build
defaults:
run:
shell: bash

on:
workflow_dispatch

jobs:
create_release:
name: Create Release
if: contains('["raub"]', github.actor)
runs-on: ubuntu-latest

outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

steps:

- name: Fetch Repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'npm'

- name: Get Package Version
id: package-version
run: node -p "'version='+require('./package').version" >> $GITHUB_OUTPUT

- name: Create Draft Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
tag_name: ${{ steps.package-version.outputs.version }}
name: Release ${{ steps.package-version.outputs.version }}
body: Binaries at ${{ github.sha }}

build:
name: Build
strategy:
matrix:
os: [ubuntu-20.04, windows-2022, macos-11]

runs-on: ${{ matrix.os }}

steps:

- name: Fetch Repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'npm'

- name: Install Modules
run: npm ci

- name: Build Current Binary
run: npm run build

- name: Get Package Version
id: package-version
run: node -p "'version='+require('./package').version" >> $GITHUB_OUTPUT

- name: Pack Files
id: pack-files
run: node -e "require('addon-tools-raub').actionPack()" >> $GITHUB_OUTPUT

- name: Store Binaries
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
tag_name: ${{ steps.package-version.outputs.version }}
name: Release ${{ steps.package-version.outputs.version }}
files: ${{ steps.pack-files.outputs.pack }}
46 changes: 46 additions & 0 deletions .github/workflows/cpplint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Cpplint
defaults:
run:
shell: bash

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
eslint:
name: Cpplint
runs-on: ubuntu-20.04

steps:

- name: Fetch Repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'npm'

- name: Install Modules
run: npm ci

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Cpplint
run: pip install cpplint

- name: Run Cpplint
run: |
node -e "require('addon-tools-raub').cpcpplint()"
cpplint --recursive ./src/cpp
36 changes: 36 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: ESLint
defaults:
run:
shell: bash

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
eslint:
name: ESLint
runs-on: ubuntu-20.04

steps:

- name: Fetch Repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'npm'

- name: Install Modules
run: npm ci

- name: Run ESLint
run: npm run eslint
Loading

0 comments on commit 1637b63

Please sign in to comment.