Skip to content

Commit 585da67

Browse files
authored
Merge pull request #7 from 2200031066/feat/github-actions
feat: add github actions for backend and frontend CI
2 parents 3cdac5e + 55bb8f5 commit 585da67

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/backend.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Backend CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
defaults:
14+
run:
15+
working-directory: backend
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python 3.10
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.10'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install flake8 pytest pytest-cov
29+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
31+
- name: Lint with flake8
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+
38+
- name: Compile C++ Genetic Algorithm core
39+
run: |
40+
g++ -std=c++17 -O3 -o Algo1 Algo.cpp
41+
42+
- name: Test with pytest
43+
run: |
44+
pytest

.github/workflows/frontend.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Frontend CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
defaults:
14+
run:
15+
working-directory: frontend
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Node.js 18.x
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18.x'
24+
cache: 'npm'
25+
cache-dependency-path: frontend/package-lock.json
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run lint
31+
run: npm run build -- --dry-run
32+
continue-on-error: true
33+
34+
- name: Run tests
35+
run: npm test -- --watchAll=false
36+
37+
- name: Build production bundle
38+
run: npm run build
39+
env:
40+
CI: true

0 commit comments

Comments
 (0)