-
Notifications
You must be signed in to change notification settings - Fork 180
98 lines (82 loc) · 2.88 KB
/
Copy pathfrontend-ci.yml
File metadata and controls
98 lines (82 loc) · 2.88 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
name: Frontend CI
on:
pull_request:
branches:
- main
paths:
- "app/frontend/**"
- ".github/workflows/frontend-ci.yml"
push:
branches:
- main
paths:
- "app/frontend/**"
- ".github/workflows/frontend-ci.yml"
jobs:
lint-and-type-check:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: app/frontend/package-lock.json
- name: Install dependencies
working-directory: ./app/frontend
run: npm ci
- name: Run ESLint
working-directory: ./app/frontend
run: npx eslint . --max-warnings 0
- name: Run TypeScript type check
working-directory: ./app/frontend
run: npx tsc --noEmit
build:
name: Build Frontend
runs-on: ubuntu-latest
needs: lint-and-type-check
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: app/frontend/package-lock.json
- name: Install dependencies
working-directory: ./app/frontend
run: npm ci
- name: Build Next.js
working-directory: ./app/frontend
run: npm run build
env:
NEXT_PUBLIC_ RustAcademy_API_URL: ${{ secrets.NEXT_PUBLIC_ RustAcademy_API_URL }}
NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }}
NEXT_PUBLIC_STELLAR_NETWORK: ${{ secrets.NEXT_PUBLIC_STELLAR_NETWORK }}
NEXT_PUBLIC_ERROR_REPORTING_ENABLED: ${{ secrets.NEXT_PUBLIC_ERROR_REPORTING_ENABLED }}
NEXT_PUBLIC_APP_VERSION: ${{ secrets.NEXT_PUBLIC_APP_VERSION }}
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run npm audit
working-directory: ./app/frontend
run: npm audit --audit-level=moderate
continue-on-error: true
- name: Check for mixed content
run: |
echo "Checking for hardcoded HTTP URLs in frontend code..."
# Search for HTTP URLs, filter out localhost, and check if any remain
if grep -r "http://" app/frontend/src --include="*.ts" --include="*.tsx" --exclude-dir=node_modules 2>/dev/null | grep -v "http://localhost" > /dev/null 2>&1; then
echo "❌ Found hardcoded HTTP URLs (non-localhost). This may cause mixed-content issues in production."
grep -r "http://" app/frontend/src --include="*.ts" --include="*.tsx" --exclude-dir=node_modules | grep -v "http://localhost"
exit 1
else
echo "✅ No problematic HTTP URLs found"
fi