Skip to content

Commit 2c2de5f

Browse files
authored
Merge pull request #1 from IRT-SystemX/feature/add-github-actions
ci: add test pipeline for GitHub Actions workflow
2 parents 4f7b1c0 + 1107290 commit 2c2de5f

2 files changed

Lines changed: 138 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Test Pipeline
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-cab_common:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v2
11+
- name: Set up Python
12+
uses: actions/setup-python@v2
13+
with:
14+
python-version: "3.11"
15+
- name: Install dependencies
16+
run: |
17+
cd backend/cab_common
18+
export PYTHONPATH=.
19+
pip install -r requirements.txt
20+
- name: Run tests
21+
run: |
22+
cd backend/cab_common
23+
pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml
24+
env:
25+
COV_CONTEXT: "backend/cab_common"
26+
27+
test-event-service:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
- name: Set up Python
33+
uses: actions/setup-python@v2
34+
with:
35+
python-version: "3.11"
36+
- name: Install dependencies
37+
run: |
38+
pip install backend/cab_common
39+
cd backend/event-service
40+
pip install -r requirements.txt
41+
- name: Run tests
42+
run: |
43+
cd backend/event-service
44+
export PYTHONPATH=.
45+
export FLASK_APP=web
46+
pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml
47+
env:
48+
COV_CONTEXT: "backend/event-service"
49+
50+
test-context-service:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v2
55+
- name: Set up Python
56+
uses: actions/setup-python@v2
57+
with:
58+
python-version: "3.11"
59+
- name: Install dependencies
60+
run: |
61+
pip install backend/cab_common
62+
cd backend/context-service
63+
pip install -r requirements.txt
64+
pip install pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-runner==6.0.1
65+
- name: Run tests
66+
run: |
67+
cd backend/context-service
68+
export PYTHONPATH=.
69+
export FLASK_APP=web
70+
pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml
71+
env:
72+
COV_CONTEXT: "backend/context-service"
73+
74+
test-recommendation-service:
75+
runs-on: ubuntu-latest
76+
container: python:3.11.6-slim
77+
steps:
78+
- name: Checkout code
79+
uses: actions/checkout@v2
80+
- name: Set up dependencies
81+
run: |
82+
mkdir -p /usr/share/man/man1
83+
apt update && apt install -y --no-install-recommends default-jre
84+
pip install backend/cab_common
85+
- name: Set up recommendation service
86+
run: |
87+
cd backend/recommendation-service
88+
pip install -r requirements.txt
89+
pip install pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-runner==6.0.1
90+
- name: Run tests
91+
run: |
92+
cd backend/recommendation-service
93+
export PYTHONPATH=.
94+
export FLASK_APP=web
95+
pytest tests --cov --cov-report term --cov-report html --cov-report xml:coverage.xml --junitxml=report.xml
96+
env:
97+
COV_CONTEXT: "backend/recommendation-service"
98+
99+
test-frontend-service:
100+
runs-on: ubuntu-latest
101+
container: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
102+
steps:
103+
- name: Checkout code
104+
uses: actions/checkout@v2
105+
- name: Set up Node.js
106+
uses: actions/setup-node@v2
107+
with:
108+
node-version: "16"
109+
- name: Install dependencies
110+
run: |
111+
cd frontend
112+
npm ci
113+
- name: Lint code
114+
run: |
115+
cd frontend
116+
npm run lint
117+
- name: Type-check code
118+
run: |
119+
cd frontend
120+
npm run type-check
121+
- name: Build project
122+
run: |
123+
cd frontend
124+
npm run build-only
125+
- name: Run tests
126+
run: |
127+
cd frontend
128+
npm run test:coverage
129+
- name: Upload coverage report
130+
if: always()
131+
uses: actions/upload-artifact@v3
132+
with:
133+
name: frontend-coverage
134+
path: frontend/coverage
135+
env:
136+
COV_CONTEXT: "frontend"

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"type": "module",
77
"scripts": {
88
"dev": "vite",
9-
"dev:": "vite --mode",
9+
"dev:mode": "vite --mode",
1010
"build": "run-p type-check \"build-only {@}\" --",
11-
"build:": "vite build --mode",
11+
"build:mode": "vite build --mode",
1212
"preview": "vite preview",
1313
"test": "run-p 'test:unit -- run' test:e2e",
1414
"test:coverage": "run-p test:unit:coverage test:e2e:coverage",

0 commit comments

Comments
 (0)