This is a simple action to allow you to run any command defined in your package.json e.g. yarn test or npm test. This command will install packages if that has not been done first, then run the supplied command.
Currently uses node:16.13.1-alpine3.15 docker container.
If you are using the default create react app, ensure that you pass in the flag --watchAll=false so that jest doesn't enter interactive mode, otherwise the action will never finish.
on: [pull_request]
jobs:
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: test --watchAll=falseThis will default to using yarn and the test command specified in your package.json. Alternatively you can define a specific script there:
"scripts": {
...
"test:ci": "react-scripts test --watchAll=false",
},Then do this:
on: [pull_request]
jobs:
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: test:cion: [pull_request]
jobs:
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
package-manager: npm
command: test:ciIn the package.json
"scripts": {
...
"test:ci": "react-scripts test --watchAll=false",
"eslint": "eslint . --ext .js --ext .jsx --ext .gql --ext .graphql",
},on: [pull_request]
jobs:
eslint:
name: run linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: eslint
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: test:ci