-
Notifications
You must be signed in to change notification settings - Fork 190
100 lines (82 loc) · 2.39 KB
/
build-test.yml
File metadata and controls
100 lines (82 loc) · 2.39 KB
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
name: Build and Test
on:
push:
branches: [main, develop]
paths:
- 'sample-app/**'
- '.github/workflows/build-test.yml'
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: 'sample-app/package-lock.json'
- name: Install dependencies
working-directory: ./sample-app
run: npm ci
- name: Run linter
working-directory: ./sample-app
run: npm run lint
continue-on-error: true
- name: Build application
working-directory: ./sample-app
run: npm run build
- name: Run tests
working-directory: ./sample-app
run: npm test
- name: Upload coverage reports
if: matrix.node-version == '18.x'
uses: actions/upload-artifact@v3
with:
name: coverage-report-${{ matrix.node-version }}
path: sample-app/coverage/
retention-days: 30
- name: Check coverage
if: always()
working-directory: ./sample-app
run: |
if [ -f coverage/coverage-summary.json ]; then
echo "✅ Coverage report generated"
else
echo "⚠️ No coverage report found"
fi
lint-check:
name: Lint Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: 'sample-app/package-lock.json'
- working-directory: ./sample-app
run: npm ci
- name: Run ESLint
working-directory: ./sample-app
run: npm run lint
continue-on-error: true
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [build-and-test]
if: always()
steps:
- name: Print test results
run: |
echo "🎯 Test Run Summary"
echo "==================="
echo "✅ All tests completed"