Skip to content

Commit

Permalink
👷 Skip audio tests in GitHub Actions
Browse files Browse the repository at this point in the history
Since the GitHub Actions runner does not have an audio device, and
creating a virtual one didn't work, only running integration tests
involving audio locally seems like a good idea for now.
  • Loading branch information
clabe45 committed Jul 24, 2023
1 parent fd8964d commit d21632f
Show file tree
Hide file tree
Showing 41 changed files with 444 additions and 391 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,25 @@ jobs:
- name: Update npm
run: |
npm i -g npm@^7.x
- name: npm install, lint, build, and test
- name: Install npm dependencies
run: |
npm ci
node node_modules/puppeteer/install.js
npm run lint
npm run build
xvfb-run --auto-servernum npm test
env:
CI: true
- name: lint code
run: npm run lint
env:
CI: true
- name: compile project
run: npm run build
env:
CI: true
- name: run unit tests
run: xvfb-run --auto-servernum npm run test:unit
env:
CI: true
- name: run smoke tests
run: xvfb-run --auto-servernum npm run test:smoke
env:
CI: true
4 changes: 3 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
npm run test
npm run test:unit
npm run test:smoke
npm run test:integration
10 changes: 8 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Thank you for considering contributing to Etro! There are many ways you can cont
git clone https://github.com/YOUR_USERNAME/etro.git
cd etro
npm install
npm test
npm run test:unit
npm run test:smoke
npm run test:integration
```

## Making your changes
Expand All @@ -31,10 +33,14 @@ Thank you for considering contributing to Etro! There are many ways you can cont
```
npm run fix
npm run build
npm test
npm test:unit
npm test:smoke
npm test:integration
```

to lint and compile the code and run the tests on them. Husky will run these commands automatically when you commit.
- *Note: Unit tests validate the logic of the code in etro, with the DOM and any other external dependencies mocked. Because audio cannot be rendered in the GitHub Actions runner, the end-to-end tests are divided into two suites. All end-to-end tests that render any audio should be placed in **spec/integration/**. All end-to-end tests that do **not** require an audio device should be placed in **spec/smoke/**. The integration tests can only be run locally, but the other two suites can be run anywhere.*

- Please commit to a new branch, not master

## Submitting your changes
Expand Down
10 changes: 8 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

process.env.CHROME_BIN = require('puppeteer').executablePath()

// Make sure TEST_SUITE is set
if (!process.env.TEST_SUITE) {
console.error('TEST_SUITE environment variable must be set')
process.exit(1)
}

module.exports = function (config) {
config.set({

Expand All @@ -16,8 +22,8 @@ module.exports = function (config) {
// list of files / patterns to load in the browser
files: [
'src/**/*.ts',
'spec/**/*.ts',
{ pattern: 'spec/integration/assets/**/*', included: false }
`spec/${process.env.TEST_SUITE}/**/*.ts`,
{ pattern: 'spec/assets/**/*', included: false }
],

// list of files / patterns to exclude
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
"lint:test": "eslint -c eslint.test-conf.js --ext .ts spec",
"lint:examples": "eslint -c eslint.example-conf.js --ext .html examples",
"start": "http-server",
"test": "karma start",
"test:unit": "TEST_SUITE=unit karma start",
"test:smoke": "TEST_SUITE=smoke karma start",
"test:integration": "TEST_SUITE=integration karma start",
"release": "shipjs prepare"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/effect/save-effect-samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function createDirs(filePath) {
// remove prefix and save to png
const buffer = Buffer.from(item.data.replace(/^data:image\/png;base64,/, ''), 'base64')
console.log(`writing ${item.path} ...`)
const path = projectDir + '/spec/integration/assets/effect/' + item.path
const path = projectDir + '/spec/assets/effect/' + item.path
createDirs(path)
fs.writeFileSync(path, buffer)
})
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
Loading

0 comments on commit d21632f

Please sign in to comment.