Skip to content

Instantly share code, notes, and snippets.

@reymon359
Created Jul 15, 2020
Embed
What would you like to do?
GitHub workflow to build and test a Create React App when a push or pull request is done to the master branch
name: Build and Test
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [10, 12]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install project
run: npm install
- name: Build the project
run: npm run build --if-present
- name: Run tests
run: npm test
@Coder2012
Copy link

Coder2012 commented Aug 28, 2022

Isn't npm ci a better option here?

@reymon359
Copy link
Author

reymon359 commented Aug 28, 2022

Isn't npm ci a better option here?

@Coder2012 thanks for the feedback! Yes, you are right.

Actually this file is 2 years old already, and its code is not up-to-date 😅

I suggest you to look for a more updated solution online 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment