-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: 🐛 add tests and standardize repo
- Loading branch information
1 parent
28a67b0
commit 8bf59ae
Showing
13 changed files
with
12,556 additions
and
124 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,28 @@ | ||
|
||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: NPM Audit Dependencies | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Setup npmrc | ||
run: echo "" >> .npmrc && echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc | ||
- run: npx audit-ci -m |
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,37 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Node.js Unit Tests | ||
|
||
on: | ||
push: | ||
branches: [ devel ] | ||
pull_request: | ||
branches: [ devel ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x, 12.x, 14.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Setup npmrc | ||
run: echo "" >> .npmrc && echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc | ||
- run: npm ci | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- run: npm run build --if-present | ||
- run: npm run test:unit | ||
env: | ||
ANNO_AI_SERVICES_CERT: ${{ secrets.ANNO_AI_SERVICES_CERT }} |
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,56 @@ | ||
name: Semantic Release | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
|
||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Setup npmrc | ||
run: echo "" >> .npmrc && echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc | ||
|
||
- run: npm ci | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- run: npm run build --if-present | ||
|
||
- run: npm run test:unit | ||
env: | ||
ANNO_AI_SERVICES_CERT: ${{ secrets.ANNO_AI_SERVICES_CERT }} | ||
|
||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v2 | ||
with: | ||
semantic_version: 17.1.1 | ||
id: semantic # Need an `id` for output variables | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Do something when a new release published | ||
if: steps.semantic.outputs.new_release_published == 'true' | ||
run: | | ||
echo ${{ steps.semantic.outputs.new_release_version }} | ||
echo ${{ steps.semantic.outputs.new_release_major_version }} | ||
echo ${{ steps.semantic.outputs.new_release_minor_version }} | ||
echo ${{ steps.semantic.outputs.new_release_patch_version }} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"spec": [ | ||
"./**/*.test.js", | ||
"./**/*.test.ts" | ||
], | ||
"require": "ts-node/register" | ||
} |
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,4 +1,3 @@ | ||
const { isRequiredEnvSet } = require('./index.js') | ||
|
||
isRequiredEnvSet('Shell', ['SHELL']) | ||
|
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,22 @@ | ||
const checkEnv = require('check-env') | ||
|
||
/** | ||
* | ||
* @param {String} name The name of the service you are checking environment variables for | ||
* @param {Array} vars Array of variable names to check if set | ||
* @param {Bool} fatal If true, function will throw error instead of printing | ||
* @param {String} type The type of service that you are checking environment variables for | ||
*/ | ||
export function isRequiredEnvSet (name: string, vars: any = [], fatal: boolean = false, type: string = 'plugin') { | ||
try { | ||
checkEnv(vars) | ||
return true | ||
} catch (err) { | ||
const _err = `${name} ${type} requires the following environment variables to be set: ${vars.join(', ')}` | ||
if (fatal) { | ||
throw new Error(_err) | ||
} | ||
console.log(_err) | ||
return false | ||
} | ||
} |
Oops, something went wrong.