Created
July 15, 2020 06:06
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
Isn't
npm ci
a better option here?