Skip to content

Commit 580448a

Browse files
spoenemannona-agent
andcommitted
Add GitHub Actions CI workflow
Add continuous integration workflow that: - Runs on push to main and feature branches - Runs on pull requests to main - Tests on Node.js 18.x and 20.x - Installs dependencies using npm ci - Builds both backend and frontend - Verifies build artifacts exist - Uploads build artifacts for inspection This ensures the application builds successfully across supported Node.js versions before merging. Co-authored-by: Ona <no-reply@ona.com>
1 parent c3dcb44 commit 580448a

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, feature/** ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
cache-dependency-path: app/package-lock.json
28+
29+
- name: Install dependencies
30+
working-directory: ./app
31+
run: npm ci
32+
33+
- name: Build backend
34+
working-directory: ./app
35+
run: npm run build --workspace=backend
36+
37+
- name: Build frontend
38+
working-directory: ./app
39+
run: npm run build --workspace=frontend
40+
41+
- name: Verify build artifacts
42+
working-directory: ./app
43+
run: |
44+
echo "Checking backend build artifacts..."
45+
test -d backend/dist || (echo "Backend dist directory not found" && exit 1)
46+
test -f backend/dist/server.js || (echo "Backend server.js not found" && exit 1)
47+
test -f backend/dist/discount-rules.js || (echo "Backend discount-rules.js not found" && exit 1)
48+
49+
echo "Checking frontend build artifacts..."
50+
test -d frontend/dist || (echo "Frontend dist directory not found" && exit 1)
51+
test -f frontend/dist/index.html || (echo "Frontend index.html not found" && exit 1)
52+
53+
echo "✅ All build artifacts verified successfully"
54+
55+
- name: Upload build artifacts
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: build-artifacts-node-${{ matrix.node-version }}
59+
path: |
60+
app/backend/dist/
61+
app/frontend/dist/
62+
retention-days: 7

0 commit comments

Comments
 (0)