From a659e060dc9403163350a5cf8946a8ab6a4c7a73 Mon Sep 17 00:00:00 2001 From: Michael Sekamanya Date: Thu, 4 Apr 2024 15:18:11 -0700 Subject: [PATCH] Add frontend tests --- .github/workflows/frontend.yml | 24 -------------- .github/workflows/{api.yml => test_api.yml} | 34 +++++++++----------- .github/workflows/test_frontend.yml | 34 ++++++++++++++++++++ .github/workflows/{rag.yml => test_rag.yml} | 35 ++++++++++----------- nesis/api/README.md | 4 +-- nesis/frontend/package.json | 11 ++++--- 6 files changed, 73 insertions(+), 69 deletions(-) delete mode 100644 .github/workflows/frontend.yml rename .github/workflows/{api.yml => test_api.yml} (73%) create mode 100644 .github/workflows/test_frontend.yml rename .github/workflows/{rag.yml => test_rag.yml} (73%) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml deleted file mode 100644 index 07e6ab4..0000000 --- a/.github/workflows/frontend.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Build/Test RAG Engine - -on: - push: - paths: - - "nesis/frontend/core/**" - - "nesis/frontend/tests/**" - - "nesis/frontend/core/requirements*" - pull_request: - paths: - - "nesis/frontend/core/**" - - "nesis/frontend/tests/**" - - "nesis/frontend/core/requirements*" - -jobs: - check-code-quality: - - runs-on: ubuntu-latest - name: Check code Quality - steps: - - name: Check out source - uses: actions/checkout@v3 - with: - fetch-depth: 0 diff --git a/.github/workflows/api.yml b/.github/workflows/test_api.yml similarity index 73% rename from .github/workflows/api.yml rename to .github/workflows/test_api.yml index 12f68bd..aacb991 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/test_api.yml @@ -1,30 +1,26 @@ -name: Build/Test API +name: Test API on: push: -# paths: -# - "nesis/api/core/**" -# - "nesis/api/tests/**" -# - "nesis/api/core/requirements*" -# pull_request: -# paths: -# - "nesis/api/core/**" -# - "nesis/api/tests/**" -# - "nesis/api/core/requirements*" + paths: + - "nesis/api/core/**" + - "nesis/api/tests/**" + - "nesis/api/core/requirements*" + pull_request: + paths: + - "nesis/api/core/**" + - "nesis/api/tests/**" + - "nesis/api/core/requirements*" jobs: - format: + linter: + name: Black formatter runs-on: ubuntu-latest - name: Check API code format steps: - - name: Check out source - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - uses: rickstaa/action-black@v1 with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" + black_args: "nesis/api/ --check" test: runs-on: ubuntu-latest name: Test API diff --git a/.github/workflows/test_frontend.yml b/.github/workflows/test_frontend.yml new file mode 100644 index 0000000..e20faa1 --- /dev/null +++ b/.github/workflows/test_frontend.yml @@ -0,0 +1,34 @@ +name: Test RAG Engine + +on: + push: +# paths: +# - "nesis/frontend/core/**" +# - "nesis/frontend/tests/**" +# - "nesis/frontend/core/requirements*" +# pull_request: +# paths: +# - "nesis/frontend/core/**" +# - "nesis/frontend/tests/**" +# - "nesis/frontend/core/requirements*" + +jobs: + lint: + runs-on: ubuntu-latest + name: Lint Frontend + steps: + - uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Install frontend dependencies + run: npm install --legacy-peer-deps --prefix client --only dev + - name: Install server dependencies + run: npm install --legacy-peer-deps + - run: npm run format:check + name: Check formatting + - name: Test API + run: npm run test:api + - name: Test frontend + run: npm run test:client \ No newline at end of file diff --git a/.github/workflows/rag.yml b/.github/workflows/test_rag.yml similarity index 73% rename from .github/workflows/rag.yml rename to .github/workflows/test_rag.yml index 65cdb9f..bf0e49f 100644 --- a/.github/workflows/rag.yml +++ b/.github/workflows/test_rag.yml @@ -1,30 +1,27 @@ -name: Build/Test Rag Engine +name: Test Rag Engine on: push: -# paths: -# - "nesis/rag/core/**" -# - "nesis/rag/tests/**" -# - "nesis/rag/core/requirements*" -# pull_request: -# paths: -# - "nesis/rag/core/**" -# - "nesis/rag/tests/**" -# - "nesis/rag/core/requirements*" + paths: + - "nesis/rag/core/**" + - "nesis/rag/tests/**" + - "nesis/rag/core/requirements*" + pull_request: + paths: + - "nesis/rag/core/**" + - "nesis/rag/tests/**" + - "nesis/rag/core/requirements*" jobs: - format: + linter: + name: Black formatter runs-on: ubuntu-latest - name: Check API code format steps: - - name: Check out source - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - uses: rickstaa/action-black@v1 with: - python-version: "3.11" + black_args: "nesis/api/ --check" + test: runs-on: ubuntu-latest name: Test RAG API diff --git a/nesis/api/README.md b/nesis/api/README.md index 0ac9dfd..abaff73 100644 --- a/nesis/api/README.md +++ b/nesis/api/README.md @@ -1,5 +1,5 @@ -# Ametnes OptimAI -Ametnes business insights AI solution +# Nesis API +Nesis API module 1. Allows you to chat with data 2. Chats with documents and enhances document knowledge retrival 3. Offers business insights diff --git a/nesis/frontend/package.json b/nesis/frontend/package.json index 700016f..17d9a23 100644 --- a/nesis/frontend/package.json +++ b/nesis/frontend/package.json @@ -1,7 +1,7 @@ { - "name": "ametnes-nosis", - "version": "1.0.0", - "description": "Ametnes OptimAI", + "name": "nosis", + "version": "0.0.1", + "description": "Nesis", "main": "main.js", "scripts": { "test:api": "mocha --recursive --timeout 5000 --reporter spec \"server/api/**/*spec.js\"", @@ -11,13 +11,14 @@ "start:server": "node server/main.js", "start:server:local": "set PROFILE=DEV && node server/main.js", "start:client": "cd client && npm run start", - "format": "node_modules/.bin/prettier --write ." + "format": "node_modules/.bin/prettier --write .", + "format:check": "node_modules/.bin/prettier --check ." }, "repository": { "type": "git", "url": "git+ssh://git@https://github.com/ametnes/nosis.git" }, - "author": "Ametnes Limited", + "author": "Nesis Contributors", "license": "ISC", "homepage": "https://https://github.com/ametnes/nosis#readme", "bugs": {