-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (89 loc) · 2.68 KB
/
web-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# HUMAN TASKS:
# 1. Verify Node.js v18.x is compatible with all project dependencies
# 2. Ensure repository secrets are configured for any sensitive data
# 3. Configure branch protection rules for main and develop branches
# 4. Set up artifact retention policies in repository settings
# REQ: Continuous Integration (2.5.2 Deployment Architecture/CI/CD)
# GitHub Actions workflow for web application CI pipeline
name: Web CI
# Trigger workflow on push and pull requests to main/develop branches
# Only when changes are made in src/web directory
on:
push:
branches:
- main
- develop
paths:
- 'src/web/**'
pull_request:
branches:
- main
- develop
paths:
- 'src/web/**'
jobs:
# REQ: Code Quality Standards (APPENDICES/A.2 Code Quality Standards)
# REQ: Testing Strategy (7.5 CI/CD Pipeline/Pipeline Stages)
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
# Checkout repository code
- name: Checkout Repository
uses: actions/checkout@v3
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
cache-dependency-path: src/web/package-lock.json
# Cache node_modules
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: src/web/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('src/web/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
# Install dependencies
- name: Install Dependencies
working-directory: src/web
run: npm ci
# Type checking
- name: TypeScript Type Check
working-directory: src/web
run: npm run typecheck
# Lint check
- name: ESLint Code Quality Check
working-directory: src/web
run: npm run lint
# Run tests
- name: Run Tests
working-directory: src/web
run: npm run test
env:
CI: true
# Build application
- name: Build Production Bundle
working-directory: src/web
run: npm run build
env:
CI: true
NODE_ENV: production
# Upload build artifacts
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: web-build
path: src/web/dist
retention-days: 7
if-no-files-found: error
# Upload test coverage
- name: Upload Test Coverage
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: src/web/coverage
retention-days: 7
if-no-files-found: error