Skip to content
Merged

CI #25

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
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI

on:
push:
branches: [dev, main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
changes:
name: Detect changed folders
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
rag: ${{ steps.filter.outputs.rag }}
model: ${{ steps.filter.outputs.model }}
steps:
- uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend:
- 'server/**'
rag:
- 'scan_report/**'
model:
- 'scan_model/**'

test-backend:
name: Backend — Jest tests
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.backend == 'true'
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: server/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test

lint-rag:
name: RAG — Ruff lint
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.rag == 'true'
steps:
- uses: actions/checkout@v4

- uses: astral-sh/ruff-action@v3
with:
src: ./scan_report

lint-model:
name: Model — Ruff lint
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.model == 'true'
steps:
- uses: actions/checkout@v4

- uses: astral-sh/ruff-action@v3
with:
src: ./scan_model
2 changes: 1 addition & 1 deletion client/src/features/dashboard/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useNavigate } from "@tanstack/react-router";
import { useQueryClient } from "@tanstack/react-query";
import { message } from "antd";
import type { ApiReportDetail } from "../Reports/types";
import { generateReportPDF } from "../Reports/generateReportPDF";
import { generateReportPDF } from "../Reports/components/generateReportPDF";
import axiosInstance from "../../../lib/axios";
import {
MdFileUpload,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MdArrowBack } from "react-icons/md";
import { C, TYPE_STYLES } from "./tokens";
import type { Notification } from "./types";
import { formatRelativeTime } from "./utils";
import { C, TYPE_STYLES } from "../tokens";
import type { Notification } from "../types";
import { formatRelativeTime } from "../utils";
import { useNavigate } from "@tanstack/react-router";

type Props = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { C, TYPE_STYLES } from "./tokens";
import type { Notification } from "./types";
import { formatRelativeTime } from "./utils";
import { C, TYPE_STYLES } from "../tokens";
import type { Notification } from "../types";
import { formatRelativeTime } from "../utils";

type Props = {
n: Notification;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
MdArrowForward,
} from "react-icons/md";

import { C, TYPE_STYLES } from "./tokens";
import type { Notification, NotifType } from "./types";
import { useFetchNotifications, useReadNotification } from "./hooks";
import { C, TYPE_STYLES } from "../tokens";
import type { Notification, NotifType } from "../types";
import { useFetchNotifications, useReadNotification } from "../hooks";
import { NotificationsSkeleton } from "./NotificationsSkeleton";
import { formatRelativeTime } from "./utils";
import { formatRelativeTime } from "../utils";

type ReadFilter = "all" | "unread" | "read";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { C } from "./tokens";
import { C } from "../tokens";

const Bone = ({ w, h, r = 6 }: { w: string | number; h: number; r?: number }) => (
<div
Expand Down
6 changes: 3 additions & 3 deletions client/src/features/dashboard/Notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Badge } from "antd";
import { MdNotificationsNone } from "react-icons/md";
import { useNavigate } from "@tanstack/react-router";

import { NotificationItem } from "./NotificationItem";
import { NotificationDetail } from "./NotificationDetail";
import { NotificationsSkeleton } from "./NotificationsSkeleton";
import { NotificationItem } from "./components/NotificationItem";
import { NotificationDetail } from "./components/NotificationDetail";
import { NotificationsSkeleton } from "./components/NotificationsSkeleton";
import { C } from "./tokens";
import type { Notification } from "./types";
import { useFetchNotifications, useReadNotification } from "./hooks";
Expand Down
2 changes: 1 addition & 1 deletion client/src/features/dashboard/Notifications/route.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createRoute, redirect } from "@tanstack/react-router";
import { useAuthStore } from "../../../store/auth.store";
import { AppLayoutRoute } from "../../landing/route";
import { NotificationsPage } from "./NotificationsPage";
import { NotificationsPage } from "./components/NotificationsPage";

export const NotificationsPageRoute = createRoute({
getParentRoute: () => AppLayoutRoute,
Expand Down
Loading
Loading