-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate tests to node test and Add key gen in node
I'm adding key generation to pure Javascript, port of `keygen-html`. I'm also migrating the mocha tests to the Node tests runner. I solved a typescript typing problem add gitea CI/CD Gitlab CI/CD and Github Actions update test
- Loading branch information
1 parent
f23fa9e
commit ad1e39a
Showing
19 changed files
with
464 additions
and
122 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,83 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
linux_test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node_version: [ 16.x, 18.x, 19.x, 20.x, 21.x ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout | ||
|
||
- uses: actions/setup-node@v4 | ||
name: Setup Node.js | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
export DEBIAN_FRONTEND=noninteractive | ||
sudo apt update | ||
if [[ $(uname -m) == "aarch64" ]];then | ||
sudo apt install -y binutils-multiarch | ||
else | ||
sudo apt install -y binutils-multiarch gcc-*aarch64-linux-gnu gcc-*aarch64-linux-gnu-base g++-*aarch64-linux-gnu libc6-arm64-cross | ||
fi | ||
npm install --no-save --ignore-scripts | ||
- name: Build addon | ||
run: npm run prebuildify -- -v | ||
|
||
- name: Test | ||
run: sudo -E node --require ts-node/register --loader ts-node/esm ./src/index_test.ts | ||
|
||
- name: Upload generate interface | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: addrs_${{ runner.os }}_${{ matrix.node_version }} | ||
path: "*.addrs.json" | ||
|
||
- name: Upload prebuilds interface | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
retention-days: 7 | ||
name: prebuilds_${{ runner.os }} | ||
path: "prebuilds/**" | ||
|
||
pack_package: | ||
needs: linux_test | ||
runs-on: ubuntu-latest | ||
name: Pack npm package | ||
env: | ||
PACKAGE_VERSION: ${{ github.ref }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Code checkout | ||
|
||
- uses: actions/setup-node@v4 | ||
name: Setup node.js | ||
with: | ||
node-version: 20.x | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: Download all artefacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: ./prebuilds | ||
|
||
- run: npm install --no-save --ignore-scripts | ||
- run: npm pack | ||
|
||
- name: Upload npm package | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Package_Pack | ||
path: "*.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
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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
image: node:lts | ||
test: | ||
only: | ||
- main | ||
stage: test | ||
image: node:latest | ||
script: | ||
- npm i -g typescript ts-node | ||
- npm install --no-save && npm i -g mocha | ||
- npm run build | ||
- mocha 'tests/**/*.ts' | ||
- npm install --no-save --ignore-scripts | ||
- npm run prebuildify -- -v | ||
- node --require ts-node/register --loader ts-node/esm ./src/index_test.ts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ node_modules/ | |
/*.tgz | ||
|
||
# Typescript | ||
src/**/*_test.* | ||
src/**/*.ts | ||
!src/**/*.d.ts | ||
|
||
|
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
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
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 |
---|---|---|
@@ -1,3 +1,14 @@ | ||
import __wg from "./src/index.js"; | ||
export const { key, wgQuick, wginterface, constants, deleteInterface, getConfig, listDevices, setConfig } = __wg; | ||
export default __wg["default"]||__wg; | ||
import * as __wg from "./src/index.js"; | ||
export const { | ||
constants, | ||
key, | ||
key_experimental, | ||
wgQuick, | ||
wginterface, | ||
getConfig, | ||
setConfig, | ||
listDevices, | ||
deleteInterface, | ||
} = __wg; | ||
|
||
export default __wg.default; |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "wireguard-tools.js", | ||
"version": "1.8.1", | ||
"description": "Control your wireguard interface from node.js, not a wireguard-tools wrapper!", | ||
"description": "Control your wireguard interface from node.js, not a wireguard-tools/wg wrapper!", | ||
"private": false, | ||
"type": "commonjs", | ||
"main": "./src/index.js", | ||
|
@@ -14,12 +14,12 @@ | |
"types": "./src/index.d.ts" | ||
} | ||
}, | ||
"homepage": "https://github.com/Sirherobrine23/Wireguard-tools.js#readme", | ||
"homepage": "https://sirherobrine23.org/Wireguard/Wireguard-tools.js#readme", | ||
"author": "Matheus Sampaio Queiroga <[email protected]> (https://sirherobrine23.org/)", | ||
"license": "GPL-3.0-or-later", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Sirherobrine23/Wireguard-tools.js.git" | ||
"url": "git+https://sirherobrine23.org/Wireguard/Wireguard-tools.js.git" | ||
}, | ||
"keywords": [ | ||
"wireguard", | ||
|
@@ -29,7 +29,7 @@ | |
"wireguard-utils" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/Sirherobrine23/Wireguard-tools.js/issues/new" | ||
"url": "https://sirherobrine23.org/Wireguard/Wireguard-tools.js/issues/new" | ||
}, | ||
"sponsor": { | ||
"url": "https://github.com/sponsors/Sirherobrine23" | ||
|
@@ -42,20 +42,19 @@ | |
}, | ||
"scripts": { | ||
"install": "node libs/build.mjs", | ||
"test": "node libs/build.mjs build --clean && mocha ./testPackage.test.cjs", | ||
"test": "node libs/build.mjs build --clean && node --require ts-node/register --loader ts-node/esm --test src/**/*_test.ts", | ||
"dev": "node libs/build.mjs build", | ||
"prebuildify": "node libs/build.mjs build --auto", | ||
"prepack": "tsc --build --clean && tsc --build && node libs/build.mjs", | ||
"postpack": "tsc --build --clean" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.8.3", | ||
"mocha": "^10.2.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.2.2" | ||
"@types/node": "^20.11.0", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"node-addon-api": "^7.0.0", | ||
"node-gyp": "^10.0.0" | ||
"node-gyp": "^10.0.1" | ||
} | ||
} | ||
} |
Oops, something went wrong.