Skip to content

Commit

Permalink
added work flow
Browse files Browse the repository at this point in the history
  • Loading branch information
AjitPadhi-Microsoft committed Nov 15, 2024
1 parent a0c4efb commit bf1c745
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
65 changes: 65 additions & 0 deletions .github/workflows/test_client_advisor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Unit Tests - Client Advisor

on:
push:
branches: main
# Trigger on changes in these specific paths
paths:
- 'ClientAdvisor/**'
pull_request:
branches: main
types:
- opened
- ready_for_review
- reopened
- synchronize
paths:
- 'ClientAdvisor/**'

jobs:
test_client_advisor:

name: Client Advisor Tests
runs-on: ubuntu-latest
# The if condition ensures that this job only runs if changes are in the ClientAdvisor folder

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Backend Dependencies
run: |
cd ClientAdvisor/App
python -m pip install -r requirements.txt
python -m pip install coverage pytest-cov
- name: Run Backend Tests with Coverage
run: |
cd ClientAdvisor/App
python -m pytest -vv --cov=. --cov-report=xml --cov-report=html --cov-report=term-missing --cov-fail-under=80 --junitxml=coverage-junit.xml
- uses: actions/upload-artifact@v4
with:
name: client-advisor-coverage
path: |
ClientAdvisor/App/coverage.xml
ClientAdvisor/App/coverage-junit.xml
ClientAdvisor/App/htmlcov/
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install Frontend Dependencies
run: |
cd ClientAdvisor/App/frontend
npm install
- name: Run Frontend Tests with Coverage
run: |
cd ClientAdvisor/App/frontend
npm run test -- --coverage
- uses: actions/upload-artifact@v4
with:
name: client-advisor-frontend-coverage
path: |
ClientAdvisor/App/frontend/coverage/
ClientAdvisor/App/frontend/coverage/lcov-report/
2 changes: 1 addition & 1 deletion ClientAdvisor/App/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

def test_format_as_ndjson():
obj = {"message": "I ❤️ 🐍 \n and escaped newlines"}
assert format_as_ndjson(obj) == '{"message": "I ❤️ 🐍 \\n and escaped newlines"}\n'
assert format_as_ndjson(obj) == '{"message": "I ❤️ 🐍 \\n and escaped new lines"}\n'

0 comments on commit bf1c745

Please sign in to comment.