-
Notifications
You must be signed in to change notification settings - Fork 1
157 lines (138 loc) · 5.15 KB
/
Copy pathfrontend.yml
File metadata and controls
157 lines (138 loc) · 5.15 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
paths:
- ".github/workflows/frontend.yml"
- "src/frontend/task-agent-web/**"
- "!src/frontend/task-agent-web/**/*.md"
pull_request:
branches:
- main
paths:
- "src/frontend/task-agent-web/**"
- "!src/frontend/task-agent-web/**/*.md"
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
name: Test
defaults:
run:
working-directory: src/frontend/task-agent-web
steps:
- uses: actions/checkout@v5
# Setup pnpm BEFORE setup-node (required for cache: 'pnpm' to work)
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: src/frontend/task-agent-web/pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Unit Tests with Coverage
run: pnpm test:coverage
- name: Generate Unit Test Summary
if: ${{ !cancelled() }}
run: |
echo "## 🧪 Unit Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f coverage/coverage-summary.json ]; then
echo "### 📊 Coverage Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Coverage |" >> $GITHUB_STEP_SUMMARY
echo "|--------|----------|" >> $GITHUB_STEP_SUMMARY
echo "| Lines | $(cat coverage/coverage-summary.json | jq -r '.total.lines.pct')% |" >> $GITHUB_STEP_SUMMARY
echo "| Statements | $(cat coverage/coverage-summary.json | jq -r '.total.statements.pct')% |" >> $GITHUB_STEP_SUMMARY
echo "| Functions | $(cat coverage/coverage-summary.json | jq -r '.total.functions.pct')% |" >> $GITHUB_STEP_SUMMARY
echo "| Branches | $(cat coverage/coverage-summary.json | jq -r '.total.branches.pct')% |" >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Coverage summary not available" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
- name: Upload Unit Test Coverage Report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: unit-test-coverage
path: src/frontend/task-agent-web/coverage/
retention-days: 30
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run E2E Tests
run: pnpm test:e2e
- name: Generate E2E Test Summary
if: ${{ !cancelled() }}
run: |
echo "## 🎭 Playwright E2E Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f playwright-report/index.html ]; then
echo "✅ E2E tests completed. See artifacts for detailed HTML report." >> $GITHUB_STEP_SUMMARY
else
echo "⚠️ Report not generated" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "📥 **Download Reports:**" >> $GITHUB_STEP_SUMMARY
echo "- \`playwright-report\` - Interactive HTML report" >> $GITHUB_STEP_SUMMARY
echo "- \`unit-test-coverage\` - Coverage HTML report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- name: Upload E2E Test Report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: src/frontend/task-agent-web/playwright-report/
retention-days: 30
- name: Upload E2E Test Results
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-test-results
path: src/frontend/task-agent-web/test-results/
retention-days: 7
build_and_deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
needs: test
if: false # Deployment disabled - no Azure Static Web Apps instances
name: Build and Deploy
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: src/frontend/task-agent-web/pnpm-lock.yaml
- name: Install dependencies
run: |
cd src/frontend/task-agent-web
pnpm install --frozen-lockfile
- name: Build Next.js
env:
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}
run: |
cd src/frontend/task-agent-web
pnpm build
- name: Deploy to Azure Static Web Apps
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "src/frontend/task-agent-web/out"
output_location: ""
skip_app_build: true
skip_api_build: true