Skip to content

Commit

Permalink
refactor: cleanup (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
wadjih-bencheikh18 committed Mar 4, 2022
1 parent 43f13e3 commit 169e2ae
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 79 deletions.
File renamed without changes.
21 changes: 21 additions & 0 deletions .github/workflows/documentationjs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Deploy documentation.js on GitHub pages

on:
workflow_dispatch:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build documentation
uses: zakodium/documentationjs-action@v1
- name: Deploy to GitHub pages
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
token: ${{ secrets.BOT_TOKEN }}
branch: gh-pages
folder: docs
clean: true
40 changes: 7 additions & 33 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,13 @@ name: Node.js CI

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

env:
NODE_VERSION: 14.x

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm install
- name: Run ESLint
run: npm run eslint
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test-coverage
- name: Send coverage report to Codecov
uses: codecov/codecov-action@v1
nodejs:
# Documentation: https://github.com/zakodium/workflows#nodejs-ci
uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1
with:
node-version-matrix: '[12, 14, 16]'
38 changes: 9 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,13 @@ on:
branches:
- master

env:
NODE_VERSION: 16.x

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Get package name
run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
token: ${{ secrets.BOT_TOKEN }}
release-type: node
package-name: ${{ env.PACKAGE_NAME }}
bump-minor-pre-major: Yes
- uses: actions/checkout@v2
# These if statements ensure that a publication only occurs when a new release is created
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}
- run: npm install
if: ${{ steps.release.outputs.release_created }}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOT_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
release:
# Documentation: https://github.com/zakodium/workflows#release
uses: zakodium/workflows/.github/workflows/release.yml@release-v1
with:
npm: true
secrets:
github-token: ${{ secrets.BOT_TOKEN }}
npm-token: ${{ secrets.NPM_BOT_TOKEN }}

26 changes: 12 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
"compile": "rollup -c",
"eslint": "eslint src",
"eslint-fix": "npm run eslint -- --fix",
"prepack": "npm run compile",
"test": "npm run test-coverage && npm run eslint",
"test-only": "jest",
"test-coverage": "jest --coverage"
"prepack": "npm run compile",
"prettier": "prettier --check src",
"prettier-write": "prettier --write src",
"test": "npm run test-only && npm run eslint",
"test-only": "jest --coverage"
},
"repository": {
"type": "git",
Expand All @@ -30,19 +31,16 @@
"url": "https://github.com/mljs/regression-exponential/issues"
},
"homepage": "https://github.com/mljs/regression-exponential#readme",
"jest": {
"testEnvironment": "node"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.14.0",
"eslint": "^7.26.0",
"eslint-config-cheminfo": "^5.2.3",
"jest": "^26.6.3",
"prettier": "^2.3.0",
"rollup": "^2.47.0"
"@babel/plugin-transform-modules-commonjs": "^7.16.8",
"eslint": "^8.10.0",
"eslint-config-cheminfo": "^7.2.2",
"jest": "^27.5.1",
"prettier": "^2.5.1",
"rollup": "^2.69.0"
},
"dependencies": {
"ml-regression-base": "^2.1.3",
"ml-regression-base": "^2.1.6",
"ml-regression-simple-linear": "^2.0.3"
}
}
6 changes: 3 additions & 3 deletions src/__tests__/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ describe('Exponential regression', () => {
expect(score.r2).toBeGreaterThan(0.8);
expect(score.chi2).toBeLessThan(0.1);
expect(score.rmsd).toBeCloseTo(0.1);
expect(result.toString(4)).toStrictEqual('f(x) = 1.580 * e^(0.3912 * x)');
expect(result.toLaTeX(4)).toStrictEqual('f(x) = 1.580e^{0.3912x}');
expect(result.toString(4)).toBe('f(x) = 1.580 * e^(0.3912 * x)');
expect(result.toLaTeX(4)).toBe('f(x) = 1.580e^{0.3912x}');
});

it('toJSON / load model', function () {
it('toJSON / load model', () => {
const regression = ExponentialRegression.load({
name: 'exponentialRegression',
A: -1,
Expand Down

0 comments on commit 169e2ae

Please sign in to comment.