Skip to content

Commit

Permalink
Add Github Action workflow for the UI code (#476)
Browse files Browse the repository at this point in the history
* Enable prettier autoformat

* Add new Github Action for the UI

* Workflow fixes
  • Loading branch information
geoffxy authored Mar 10, 2024
1 parent d52173e commit 23be40b
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 6 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/check_js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Check JS Code

on:
push:
branches: [ main ]
paths:
- 'ui/**'
pull_request:
branches: [ main ]
paths:
- 'ui/**'
workflow_dispatch: {}

jobs:
build:
name: Check JS Code
timeout-minutes: 30

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Set Up Node 20
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install Dependencies
working-directory: ui
run: npm install

- name: Check Formatting (prettier)
working-directory: ui
run: npm run fcheck
if: success() || failure()

- name: Lint (eslint)
working-directory: ui
run: npm run lint
if: success() || failure()

- name: Run Build (vite)
working-directory: ui
run: npm run build
if: success() || failure()
1 change: 1 addition & 0 deletions ui/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/**
29 changes: 29 additions & 0 deletions ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["eslint:recommended", "plugin:react/recommended"],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
plugins: ["react"],
rules: {},
settings: {
react: {
version: "detect",
},
},
};
3 changes: 3 additions & 0 deletions ui/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
__pycache__
2 changes: 1 addition & 1 deletion ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"lint": "eslint .",
"preview": "vite preview",
"watch": "vite build --watch"
"watch": "vite build --watch",
"format": "prettier --write .",
"check": "prettier --check . ; eslint .",
"fcheck": "prettier --check ."
},
"dependencies": {
"axios": "^1.6.7",
Expand All @@ -22,7 +25,7 @@
"@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"prettier": "3.2.5",
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/PerfView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function PerfView({ metricsData }) {
yLabel="p90 Latency (s)"
/>
</div>
<div style={{"marginTop": "30px"}}>
<div style={{ marginTop: "30px" }}>
<h2>Transaction Latency</h2>
<LatencyPlot
seriesName="Transaction Latency"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/TableView.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./styles/TableView.css";

function WriterMarker({color}) {
function WriterMarker({ color }) {
return <div class={`db-table-view-writer ${color}`}>W</div>;
}

Expand Down

0 comments on commit 23be40b

Please sign in to comment.