-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (53 loc) · 1.9 KB
/
react-test.js.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Integration - Frontend
on:
pull_request:
branches:
- main
paths:
- "react-fm/**"
jobs:
build:
# Defines the type of runner the job runs on
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout to the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up NodeJS environment
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# Consider this as an add on to optimize the execution of actions
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install package dependencies
run: npm ci
working-directory: react-fm
- name: Check linting and formatting
# Custom script for checking the linting and formatting being in place
run: npm run lint
working-directory: react-fm
# Run test cases and this could ensure minimum coverage as well if set
# - name: Execute test cases
# run: npm run test
# working-directory: react-fm
- name: Create test build
run: npm run build
working-directory: react-fm