I use Yarn to run my Jest tests.
package.json
{
"scripts": {
"test": "jest"
}
}
yarn test
I want to create a GitHub action to run my tests when I merge commits in GitHub. The Node Starter Workflow runs tests with NPM. But I want to run them with Yarn.
How do I create an action to run my tests?
Use the Node Starter Workflow but replace the NPM portion with Yarn commands. For example:
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.19.1]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test