Repository navigation
106 lines (95 loc) · 3.03 KB
/
Copy pathfrontend-build.yml
File metadata and controls
106 lines (95 loc) · 3.03 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
name: Frontend Build
on:
workflow_call:
inputs:
node-version:
description: 'Node.js version'
required: false
type: string
default: '18'
cache-key:
description: 'Cache key for dependencies'
required: false
type: string
outputs:
dist-path:
description: 'Path to built frontend dist'
value: ${{ jobs.build.outputs.dist-path }}
jobs:
build:
runs-on: [self-hosted, linux, x64]
timeout-minutes: 20 # Reduced timeout with faster runner
outputs:
dist-path: ${{ steps.build.outputs.dist-path }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ inputs.node-version }}
cache: 'yarn'
cache-dependency-path: desktop/yarn.lock
- name: Cache node modules and yarn cache
uses: actions/cache@v4
with:
path: |
desktop/node_modules
~/.yarn
key: ${{ inputs.cache-key }}-yarn-${{ inputs.node-version }}-${{ hashFiles('desktop/yarn.lock') }}
restore-keys: |
${{ inputs.cache-key }}-yarn-${{ inputs.node-version }}-
${{ inputs.cache-key }}-yarn-
- name: Set environment variables for CI
env:
NODE_OPTIONS: --max-old-space-size=8192
npm_config_legacy_peer_deps: true
npm_config_cache: ~/.npm-cache
run: |
echo "Environment variables set for CI build"
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -yqq --no-install-recommends \
python3 \
make \
g++ \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
libnss3-dev \
libatk-bridge2.0-dev \
libdrm2 \
libxkbcommon-dev \
libxcomposite-dev \
libxdamage-dev \
libxrandr-dev \
libgbm-dev \
libxss-dev \
libasound2-dev
- name: Run frontend build and tests
run: ./scripts/ci-check-frontend.sh
- name: Set dist path output
id: build
run: |
if [[ -d desktop/dist ]]; then
echo "Frontend build completed successfully"
echo "dist-path=desktop/dist" >> $GITHUB_OUTPUT
else
echo "Frontend build failed, creating fallback"
mkdir -p desktop/dist
echo '<html><body><h1>Build Failed</h1></body></html>' > desktop/dist/index.html
echo "dist-path=desktop/dist" >> $GITHUB_OUTPUT
fi
- name: Upload frontend artifacts
uses: actions/upload-artifact@v5
with:
name: frontend-dist
path: desktop/dist
retention-days: 30
- name: Verify build output
run: |
ls -la desktop/dist
echo "Frontend build completed successfully"