Skip to content

Commit ad0e701

Browse files
authored
Add actions and move tests to cypress (#47)
1 parent b0061d8 commit ad0e701

35 files changed

+1635
-592
lines changed

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ module.exports = {
3737
],
3838
'@typescript-eslint/no-shadow': ["error"]
3939
}
40+
},
41+
{
42+
files: ['test/**/*.ts', 'cypress/**/*.ts'],
43+
extends: ['plugin:cypress/recommended'],
44+
rules: {
45+
'no-unused-expressions': 0,
46+
'no-unused-vars': 0
47+
}
4048
}
4149
],
4250

.github/workflows/codestyle.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Codestyle
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
paths:
8+
- '**/src/*.js'
9+
- '**/src/*.ts'
10+
- '.github/workflows/codestyle.yml'
11+
pull_request:
12+
branches: [ master, 'v[0-9]+.[0-9]+' ]
13+
paths:
14+
- '**/src/*.js'
15+
- '**/src/*.ts'
16+
- '.github/workflows/codestyle.yml'
17+
18+
jobs:
19+
check-web-codestyle:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Set up Node.js LTS
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: lts/*
29+
30+
- name: Pre-build dependencies
31+
run: npm install yarn
32+
33+
- name: Run Binding Linter
34+
run: yarn && yarn lint

.github/workflows/demo.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Package-build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
paths:
8+
- "demo/**"
9+
- '.github/workflows/demo.yml'
10+
pull_request:
11+
branches: [ master, 'v[0-9]+.[0-9]+' ]
12+
paths:
13+
- "demo/**"
14+
- '.github/workflows/demo.yml'
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
strategy:
21+
matrix:
22+
node-version: [ 14.x, 16.x, 18.x, 20.x ]
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up Node.js
28+
uses: actions/setup-node@v3
29+
30+
- name: Pre-build dependencies
31+
run: npm install yarn
32+
33+
- name: Install dependencies
34+
run: yarn install

.github/workflows/link-check.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Check Markdown links
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master, 'v[0-9]+.[0-9]+' ]
9+
10+
jobs:
11+
markdown-link-check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@master
15+
- uses: gaurav-nelson/[email protected]
16+
with:
17+
use-quiet-mode: 'yes'
18+
use-verbose-mode: 'yes'

.github/workflows/package.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,33 @@ name: Package-build
33
on:
44
workflow_dispatch:
55
push:
6-
branches: [master]
6+
branches: [ master ]
77
paths:
88
- "audio/**"
99
- "src/**"
1010
- "lib/**"
11+
- '.github/workflows/package.yml'
1112
pull_request:
12-
branches: [master]
13+
branches: [ master, 'v[0-9]+.[0-9]+' ]
1314
paths:
1415
- "audio/**"
1516
- "src/**"
1617
- "lib/**"
18+
- '.github/workflows/package.yml'
1719

1820
jobs:
1921
build:
2022
runs-on: ubuntu-latest
2123

22-
steps:
23-
- uses: actions/checkout@v2
24+
strategy:
25+
matrix:
26+
node-version: [ 14.x, 16.x, 18.x, 20.x ]
2427

25-
- name: Set up Python
26-
uses: actions/setup-python@v2
28+
steps:
29+
- uses: actions/checkout@v3
2730

2831
- name: Set up Node.js
29-
uses: actions/setup-node@v2
30-
31-
- name: Install system dependencies
32-
run: |
33-
pip install selenium
34-
pip install webdriver-manager
32+
uses: actions/setup-node@v3
3533

3634
- name: Pre-build dependencies
3735
run: npm install yarn
@@ -46,4 +44,4 @@ jobs:
4644
run: yarn && yarn build
4745

4846
- name: Test
49-
run: python3 test/selenium_test.py
47+
run: yarn test

.github/workflows/spell-check.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: SpellCheck
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master, 'v[0-9]+.[0-9]+' ]
9+
10+
jobs:
11+
markdown:
12+
runs-on: ubuntu-20.04
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 18
20+
21+
- name: Install CSpell
22+
run: npm install -g cspell
23+
24+
- name: Run CSpell
25+
run: cspell --config resources/.lint/spell-check/.cspell.json "**/*"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
node_modules
33
.DS_Store
44
dist
5-
package-lock.json
5+
package-lock.json
6+
cypress/downloads

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Web Voice Processor
22

33
[![GitHub release](https://img.shields.io/github/release/Picovoice/web-voice-processor.svg)](https://github.com/Picovoice/web-voice-processor/releases)
4+
[![GitHub](https://img.shields.io/github/license/Picovoice/web-voice-processor)](https://github.com/Picovoice/web-voice-processor/releases)
5+
[![npm](https://img.shields.io/npm/v/@picovoice/web-voice-processor?label=npm%20%5Bweb%5D)](https://www.npmjs.com/package/@picovoice/web-voice-processor)
46

57
Made in Vancouver, Canada by [Picovoice](https://picovoice.ai)
68

@@ -14,10 +16,9 @@ A library for real-time voice processing in web browsers.
1416
- [Web Voice Processor](#web-voice-processor)
1517
- [Browser compatibility](#browser-compatibility)
1618
- [Browser features](#browser-features)
17-
- [AudioWorklet & Safari](#audioworklet---safari)
1819
- [Installation](#installation)
1920
- [How to use](#how-to-use)
20-
- [Via ES Modules (Create React App, Angular, Webpack, etc.)](#via-es-modules--create-react-app--angular--webpack--etc-)
21+
- [Via ES Modules (Create React App, Angular, Webpack, etc.)](#via-es-modules-create-react-app-angular-webpack-etc)
2122
- [Via HTML script tag](#via-html-script-tag)
2223
- [Start listening](#start-listening)
2324
- [Stop listening](#stop-listening)
@@ -104,7 +105,7 @@ await WebVoiceProcessor.subscribe(worker);
104105
await WebVoiceProcessor.subscribe([engine, worker]);
105106
```
106107

107-
An `engine` is either a [Web Workers](<(https://developer.mozilla.org/en-US/docs/Web/API/Worker)>) or an object
108+
An `engine` is either a [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Worker) or an object
108109
implementing the following interface within their `onmessage` method:
109110

110111
```javascript
@@ -119,7 +120,7 @@ onmessage = function (e) {
119120

120121
where `e.data.inputFrame` is an `Int16Array` of `frameLength` audio samples.
121122

122-
For examples of using engines, look at [src/engines](/package/src/engines).
123+
For examples of using engines, look at [src/engines](src/engines).
123124

124125
This is async due to its [Web Audio API microphone request](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia). The promise will be rejected if the user refuses permission, no suitable devices are found, etc. Your calling code should anticipate the possibility of rejection. When the promise resolves, the WebVoiceProcessor is running.
125126

cypress.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { defineConfig } from "cypress";
2+
3+
export default defineConfig({
4+
env: {
5+
"DEBUG": false,
6+
},
7+
e2e: {
8+
defaultCommandTimeout: 30000,
9+
supportFile: "cypress/support/index.ts",
10+
specPattern: "test/*.test.{js,jsx,ts,tsx}",
11+
video: false,
12+
screenshotOnRunFailure: false,
13+
}
14+
});

cypress/fixtures/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)