-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from xenosf/testing-ci
Add CI workflows (testing & linting)
- Loading branch information
Showing
41 changed files
with
25,919 additions
and
2,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Automated Testing (Client) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
client: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./client | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Make envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_REACT_APP_API_BASE_URL: http://localhost | ||
directory: . | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Install Client Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Static Analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Install Client Dependencies | ||
run: | | ||
cd client | ||
npm ci | ||
cd .. | ||
- name: Install Server Dependencies | ||
run: | | ||
cd server | ||
npm ci | ||
cd .. | ||
- name: Install Outer Folder Dependencies | ||
run: | | ||
npm ci | ||
- name: Run Lint Checks (eslint) | ||
run: npx eslint . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
name: Automated Testing (Server) | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
matching-service: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./server/matching-service | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Make envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_ENV: PROD | ||
envkey_PORT_MATCHING: 3003 | ||
directory: . | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Install Matching Service Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: npm run test | ||
question-service: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./server/question-service | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Make envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_ENV: PROD | ||
envkey_PORT_QUESTION: 3002 | ||
envkey_DB_URI_QUESTION: mongodb://localhost:27017/question | ||
directory: . | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Install Question Service Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: npm run test | ||
user-service: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./server/user-service | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Make envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_ENV: PROD | ||
envkey_PORT_USER: 3001 | ||
envkey_DB_URI_USER: mongodb://localhost:27017/user | ||
envkey_JWT_SECRET: secret | ||
directory: . | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Install User Service Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: npm run test | ||
collaboration-service: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./server/collaboration-service | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Make envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_ENV: PROD | ||
envkey_PORT_COLLABORATION: 3004 | ||
directory: . | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Install Collaboration Service Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: npm run test | ||
ai-service: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./server/ai-service | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Make envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_ENV: PROD | ||
envkey_PORT_AI: 3005 | ||
envkey_GEMINI_API_KEY: '' | ||
directory: . | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Install AI Service Dependencies | ||
run: npm ci | ||
- name: Run Tests | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: System Testing | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
system: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
browser: [firefox, chrome] | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
BROWSER: ${{ matrix.browser }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: Install Outer Folder Dependencies | ||
run: | | ||
npm ci | ||
- name: Make client envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_REACT_APP_API_BASE_URL: http://localhost | ||
directory: client | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Make server envfile | ||
uses: SpicyPizza/create-envfile@v2.0 | ||
with: | ||
envkey_ENV: PROD | ||
envkey_PORT_USER: 3001 | ||
envkey_PORT_QUESTION: 3002 | ||
envkey_PORT_MATCHING: 3003 | ||
envkey_PORT_COLLABORATION: 3004 | ||
envkey_PORT_AI: 3005 | ||
envkey_GEMINI_API_KEY: '' | ||
envkey_DB_URI_QUESTION: mongodb://localhost:27017/question | ||
envkey_DB_URI_USER: mongodb://localhost:27017/user | ||
envkey_JWT_SECRET: secret | ||
directory: server | ||
file_name: .env | ||
fail_on_empty: false | ||
sort_keys: false | ||
- name: Start MongoDB | ||
uses: supercharge/mongodb-github-action@1.11.0 | ||
with: | ||
mongodb-version: latest | ||
- name: Setup & run server | ||
run: | | ||
cd server | ||
docker compose -f docker-compose.local.yml build | ||
docker compose -f docker-compose.local.yml up -d | ||
- name: Setup & run client | ||
run: | | ||
cd client | ||
npm ci | ||
npm run start & | ||
- name: Run Tests | ||
run: | | ||
sleep 60 | ||
xvfb-run --server-args="-screen 0 1024x768x24" npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ node_modules | |
**/.env | ||
**/.DS_Store | ||
server/matching-service/dump.rdb | ||
server/matching-service/dist | ||
**/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import App from './App'; | ||
import { render, screen } from "@testing-library/react"; | ||
import App from "./App"; | ||
import { BrowserRouter } from "react-router-dom"; | ||
|
||
test('renders learn react link', () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
test('renders "PeerPrep" text (in toolbar)', () => { | ||
render( | ||
<BrowserRouter> | ||
<App /> | ||
</BrowserRouter> | ||
); | ||
const peerprep = screen.getByText(/PeerPrep/i); | ||
expect(peerprep).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.