Skip to content

Commit 4f5b6b2

Browse files
Merge pull request #138 from Golden-Eagle07/5-devops-configure-github-actions-ci-for-react-eslint-prettier-build-test
Added CI activity for react
2 parents 9b8297d + 3413080 commit 4f5b6b2

9 files changed

Lines changed: 87 additions & 29 deletions

File tree

.github/workflows/frontend-ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Frontend Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout source code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "24"
22+
23+
24+
- name: Install dependencies
25+
run: |
26+
cd frontend
27+
npm ci
28+
29+
- name: check prettier formatting
30+
working-directory: frontend
31+
run: npm run format:check
32+
33+
- name: Run ESling
34+
working-directory: frontend
35+
run: npm run lint
36+
37+
- name: Build project
38+
working-directory: frontend
39+
run: npm run build

frontend/eslint.config.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import { defineConfig, globalIgnores } from 'eslint/config'
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import { defineConfig, globalIgnores } from "eslint/config";
66

77
export default defineConfig([
8-
globalIgnores(['dist']),
8+
globalIgnores(["dist"]),
99
{
10-
files: ['**/*.{js,jsx}'],
10+
files: ["**/*.{js,jsx}"],
1111
extends: [
1212
js.configs.recommended,
1313
reactHooks.configs.flat.recommended,
@@ -18,4 +18,4 @@ export default defineConfig([
1818
parserOptions: { ecmaFeatures: { jsx: true } },
1919
},
2020
},
21-
])
21+
]);

frontend/package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"dev": "vite",
88
"build": "vite build",
99
"lint": "eslint .",
10-
"preview": "vite preview"
10+
"preview": "vite preview",
11+
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,css,md,json}\""
1112
},
1213
"dependencies": {
1314
"@reduxjs/toolkit": "^2.12.0",
@@ -29,6 +30,7 @@
2930
"eslint-plugin-react-hooks": "^7.1.1",
3031
"eslint-plugin-react-refresh": "^0.5.3",
3132
"globals": "^17.7.0",
33+
"prettier": "^3.9.6",
3234
"vite": "^8.2.0"
3335
}
3436
}

frontend/src/App.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167

168168
&::before,
169169
&::after {
170-
content: '';
170+
content: "";
171171
position: absolute;
172172
top: -4.5px;
173173
border: 5px solid transparent;

frontend/src/App.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { useState } from 'react'
2-
import reactLogo from './assets/react.svg'
3-
import viteLogo from './assets/vite.svg'
4-
import heroImg from './assets/hero.png'
5-
import './App.css'
1+
import { useState } from "react";
2+
import reactLogo from "./assets/react.svg";
3+
import viteLogo from "./assets/vite.svg";
4+
import heroImg from "./assets/hero.png";
5+
import "./App.css";
66

77
function App() {
8-
const [count, setCount] = useState(0)
8+
const [count, setCount] = useState(0);
99

1010
return (
1111
<>
@@ -116,7 +116,7 @@ function App() {
116116
<div className="ticks"></div>
117117
<section id="spacer"></section>
118118
</>
119-
)
119+
);
120120
}
121121

122-
export default App
122+
export default App;

frontend/src/index.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
--shadow:
1212
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
1313

14-
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
15-
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
14+
--sans: system-ui, "Segoe UI", Roboto, sans-serif;
15+
--heading: system-ui, "Segoe UI", Roboto, sans-serif;
1616
--mono: ui-monospace, Consolas, monospace;
1717

1818
font: 18px/145% var(--sans);

frontend/src/main.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { StrictMode } from 'react'
2-
import { createRoot } from 'react-dom/client'
3-
import './index.css'
4-
import App from './App.jsx'
1+
import { StrictMode } from "react";
2+
import { createRoot } from "react-dom/client";
3+
import "./index.css";
4+
import App from "./App.jsx";
55

6-
createRoot(document.getElementById('root')).render(
6+
createRoot(document.getElementById("root")).render(
77
<StrictMode>
88
<App />
99
</StrictMode>,
10-
)
10+
);

frontend/vite.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { defineConfig } from 'vite'
2-
import react from '@vitejs/plugin-react'
1+
import { defineConfig } from "vite";
2+
import react from "@vitejs/plugin-react";
33

44
// https://vite.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7-
})
7+
});

0 commit comments

Comments
 (0)