-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (125 loc) · 4.49 KB
/
ci.yml
File metadata and controls
147 lines (125 loc) · 4.49 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
build-sdk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Cache SDK build
id: sdk-cache
uses: actions/cache@v4
with:
path: |
editors/sdkjs/cell/sdk-all.js
editors/sdkjs/cell/sdk-all-min.js
editors/sdkjs/word/sdk-all.js
editors/sdkjs/word/sdk-all-min.js
editors/sdkjs/slide/sdk-all.js
editors/sdkjs/slide/sdk-all-min.js
editors/sdkjs/visio/sdk-all.js
editors/sdkjs/visio/sdk-all-min.js
key: sdk-build-${{ hashFiles('sdkjs/common/**/*.js', 'sdkjs/cell/**/*.js', 'sdkjs/word/**/*.js', 'sdkjs/slide/**/*.js', 'sdkjs/visio/**/*.js', 'sdkjs/build/Gruntfile.js') }}
- name: Build SDK
if: steps.sdk-cache.outputs.cache-hit != 'true'
run: bun run build
- name: Upload SDK artifact
uses: actions/upload-artifact@v4
with:
name: sdk-build
path: |
editors/sdkjs/cell/sdk-all.js
editors/sdkjs/cell/sdk-all-min.js
editors/sdkjs/word/sdk-all.js
editors/sdkjs/word/sdk-all-min.js
editors/sdkjs/slide/sdk-all.js
editors/sdkjs/slide/sdk-all-min.js
editors/sdkjs/visio/sdk-all.js
editors/sdkjs/visio/sdk-all-min.js
test:
needs: build-sdk
strategy:
matrix:
include:
- os: ubuntu-latest
test-cmd: bun run test:unit
- os: macos-latest
test-cmd: bun run test:all
- os: windows-latest
test-cmd: bun run test:all
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Download SDK build
uses: actions/download-artifact@v4
with:
name: sdk-build
path: editors/sdkjs
- name: Cache Playwright browsers
if: matrix.os != 'ubuntu-latest'
id: playwright-cache
uses: actions/cache@v4
with:
path: |
~/Library/Caches/ms-playwright
~/AppData/Local/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('bun.lock') }}
- name: Install Playwright browsers
if: matrix.os != 'ubuntu-latest' && steps.playwright-cache.outputs.cache-hit != 'true'
run: bunx playwright install chromium
- name: Cache converter
if: matrix.os != 'ubuntu-latest'
uses: actions/cache@v4
with:
path: converter
key: converter-${{ runner.os }}-${{ runner.arch }}-v9.1.0
- name: Setup server (macOS)
if: matrix.os == 'macos-latest'
run: |
bun download-converter.js
bun scripts/build_allfontsgen.js
FONT_DATA_DIR=assets/onlyoffice-fontdata bun ./scripts/generate_office_fonts.js
- name: Setup server (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
bun download-converter.js
Copy-Item vendor/vcruntime/*.dll converter/
Get-ChildItem converter/*.dll | ForEach-Object { Write-Output "Bundled $($_.Name) ($($_.Length) bytes)" }
bun scripts/build_allfontsgen.js
$env:FONT_DATA_DIR="assets/onlyoffice-fontdata"; bun ./scripts/generate_office_fonts.js
- name: Start server (macOS)
if: matrix.os == 'macos-latest'
run: FONT_DATA_DIR=assets/onlyoffice-fontdata bun server.js &
- name: Start server (Windows)
if: matrix.os == 'windows-latest'
env:
FONT_DATA_DIR: assets/onlyoffice-fontdata
run: cmd /c "start /b bun server.js"
- name: Wait for server
if: matrix.os != 'ubuntu-latest'
shell: bash
run: |
for i in {1..30}; do
curl -s http://localhost:38123 > /dev/null && break
sleep 1
done
- name: Run tests
run: ${{ matrix.test-cmd }}
- name: Verify server compiles
run: bunx esbuild server.js --minify --outfile=dist/server.js
- name: Verify build output
shell: bash
run: |
test -f dist/server.js || (echo "Build failed: dist/server.js not found" && exit 1)
echo "Build successful: dist/server.js exists ($(wc -c < dist/server.js) bytes)"