diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..0b1f931 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,97 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: build and node tests + runs-on: ubuntu-latest + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + node-version: [10.x, 16.x, 18.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: install + run: npm ci + + - name: lint + run: npm run lint + + - name: build + run: npm run build:js + + - name: docs + run: npm run docs + + - name: node tests + run: npm run test:node + + - if: matrix.node-version == '16.x' + name: browser tests + run: npm run test:browser-headless + + publication: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: EndBug/version-check@v1 + id: check + + - name: check version changes + if: steps.check.outputs.changed == 'true' + run: 'echo "Version change found! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' + + - uses: actions/setup-node@v1 + if: steps.check.outputs.changed == 'true' + with: + node-version: 16 + registry-url: https://registry.npmjs.org/ + + - name: install + if: steps.check.outputs.changed == 'true' + run: npm ci + + - name: lint + if: steps.check.outputs.changed == 'true' + run: npm run lint + + - name: build + if: steps.check.outputs.changed == 'true' + run: npm run build:js + + - name: docs + if: steps.check.outputs.changed == 'true' + run: npm run docs + + - name: browser tests + if: steps.check.outputs.changed == 'true' + run: npm run test:browser-headless + + - name: node tests and coverage + if: steps.check.outputs.changed == 'true' + run: npm run coverage + + - name: send report to coveralls.io + if: steps.check.outputs.changed == 'true' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: publish to NPM + if: steps.check.outputs.changed == 'true' + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index a5791cf..0ea33a3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) -[![Node CI](https://github.com/juanelas/bigint-crypto-utils/workflows/Node%20CI/badge.svg)](https://github.com/juanelas/bigint-crypto-utils/actions?query=workflow%3A%22Node+CI%22) +[![build](https://github.com/juanelas/bigint-crypto-utils/workflows/build/badge.svg)](https://github.com/juanelas/bigint-crypto-utils/actions?query=workflow%3A%22build%22) [![Coverage Status](https://coveralls.io/repos/github/juanelas/bigint-crypto-utils/badge.svg?branch=master)](https://coveralls.io/github/juanelas/bigint-crypto-utils?branch=master) # bigint-crypto-utils diff --git a/docs/API.md b/docs/API.md index c15de59..023e0cc 100644 --- a/docs/API.md +++ b/docs/API.md @@ -153,7 +153,7 @@ A promise that resolves to a boolean that is either true (a probably prime numbe #### Defined in -[src/ts/isProbablyPrime.ts:21](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/isProbablyPrime.ts#L21) +[src/ts/isProbablyPrime.ts:21](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/isProbablyPrime.ts#L21) ___ @@ -317,7 +317,7 @@ A promise that resolves to a bigint probable prime of bitLength bits. #### Defined in -[src/ts/prime.ts:21](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/prime.ts#L21) +[src/ts/prime.ts:21](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/prime.ts#L21) ___ @@ -346,7 +346,7 @@ A bigint probable prime of bitLength bits. #### Defined in -[src/ts/prime.ts:100](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/prime.ts#L100) +[src/ts/prime.ts:100](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/prime.ts#L100) ___ @@ -374,7 +374,7 @@ A cryptographically secure random bigint between [min,max] #### Defined in -[src/ts/randBetween.ts:15](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/randBetween.ts#L15) +[src/ts/randBetween.ts:15](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/randBetween.ts#L15) ___ @@ -402,7 +402,7 @@ A Promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cry #### Defined in -[src/ts/randBits.ts:14](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/randBits.ts#L14) +[src/ts/randBits.ts:14](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/randBits.ts#L14) ___ @@ -430,7 +430,7 @@ A Uint8Array/Buffer (Browser/Node.js) filled with cryptographically secure rando #### Defined in -[src/ts/randBits.ts:45](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/randBits.ts#L45) +[src/ts/randBits.ts:45](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/randBits.ts#L45) ___ @@ -458,7 +458,7 @@ A promise that resolves to a UInt8Array/Buffer (Browser/Node.js) filled with cry #### Defined in -[src/ts/randBytes.ts:12](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/randBytes.ts#L12) +[src/ts/randBytes.ts:12](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/randBytes.ts#L12) ___ @@ -486,7 +486,7 @@ A UInt8Array/Buffer (Browser/Node.js) filled with cryptographically secure rando #### Defined in -[src/ts/randBytes.ts:46](https://github.com/juanelas/bigint-crypto-utils/blob/66b761d/src/ts/randBytes.ts#L46) +[src/ts/randBytes.ts:46](https://github.com/juanelas/bigint-crypto-utils/blob/b2b3b8f/src/ts/randBytes.ts#L46) ___