Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/ci_react_frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "React frontend CI"

# events
on:
push:
branches: ["main"]
# paths
paths:
- 'frontend/**'
pull_request:
branches: ["main"]
# paths
paths:
- 'frontend/**'

env:
node_version: 16.x
defaults:
run:
working-directory: ./frontend

jobs:
build: #first job
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.1.7 # action

- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v4.0.3
with:
node-version: ${{ env.node_version }}
cache: 'npm'
cache-dependency-path: './frontend/package-lock.json'

- name: Run npm clean install
run: npm ci

- run: npm run build --if-present

test:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4.1.7

- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v4.0.3
with:
node-version: ${{ env.node_version }}
cache: 'npm'
cache-dependency-path: './frontend/package-lock.json'
- name: "Run test on frontend"
run: npm ci
- run: npm test
16 changes: 15 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"start": "PORT=8080 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test": "react-scripts test --watchAll=false --coverage",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand All @@ -41,5 +41,19 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"collectCoverageFrom": [
"src/**/*.tsx"
],
"coverageThreshold": {
"global": {
"lines": 85
}
},
"coverageReporters": [
"html",
"text"
]
}
}
Loading