Skip to content

Instantly share code, notes, and snippets.

@reymon359
Created July 15, 2020 06:06
Show Gist options
  • Save reymon359/514cf378456457f1798293fe0ed99f3a to your computer and use it in GitHub Desktop.
Save reymon359/514cf378456457f1798293fe0ed99f3a to your computer and use it in GitHub Desktop.
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

Isn't npm ci a better option here?

@reymon359
Copy link
Author

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