-
Notifications
You must be signed in to change notification settings - Fork 2k
153 lines (135 loc) · 5.53 KB
/
web-npm_test.yml
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
name: <Web> npm test
on: [push, pull_request]
# github.head_ref is only defined on pull_request events
concurrency:
group: ${{ github.workflow }}-${{ github.actor }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
npm_test:
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Setup emsdk
uses: dumganhar/setup-emsdk@997d2cde2deabda085a11f98e86e842915b0e846
with:
version: 3.1.41
actions-cache-folder: 'emsdk-cache-3.1.41'
- name: Verify
run: |
which emcc
emcc -v
- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja
- name: Download external
run: |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external
- name: Apply emscripten patches
run: |
echo "--------------------------------- Save bind.cpp ---------------------------------"
cp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp.bak
echo "--------------------------------- Apply embind bind.cpp patches ---------------------------------"
cp -f ./.github/workflows/emscripten-patches/embind/bind.cpp $EMSDK/upstream/emscripten/system/lib/embind/
echo "--------------------------------- Apply patches DONE! ---------------------------------"
cat $EMSDK/upstream/emscripten/system/lib/embind/bind.cpp
- name: Build Spine 3.8 WASM
run: |
cd ./native/cocos/editor-support/spine-wasm
rm -rf build-wasm
mkdir build-wasm
cd build-wasm
emcmake cmake .. -GNinja
ninja
ls -l
- name: Build Spine 3.8 ASMJS
run: |
cd ./native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
rm -rf build-asmjs
mkdir build-asmjs
cd build-asmjs
emcmake cmake .. -GNinja
ninja
ls -l
- name: Copy Spine 3.8 files to external directory
run: |
SPINE_VERSION="3.8"
DIST_PATH="dist/3.8"
rm -rf $DIST_PATH
mkdir -p $DIST_PATH
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
mkdir -p ./native/external/emscripten/spine/$SPINE_VERSION
echo "-------- Before replace spine wasm -----------"
ls -l ./native/external/emscripten/spine/$SPINE_VERSION
cp -f ./$DIST_PATH/* ./native/external/emscripten/spine/$SPINE_VERSION
echo "-------- After replace spine wasm ------------"
ls -l ./native/external/emscripten/spine/$SPINE_VERSION
echo "-----------------------------------------------"
cd ./native/external
git status
- name: Build Spine 4.2 WASM
run: |
cd ./native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 0)/set(BUILD_WASM 1)/g' CMakeLists.txt
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
rm -rf build-wasm
mkdir build-wasm
cd build-wasm
emcmake cmake .. -GNinja
ninja
ls -l
- name: Build Spine 4.2 ASMJS
run: |
cd ./native/cocos/editor-support/spine-wasm
sed -i 's/set(SPINE_VERSION "3.8")/set(SPINE_VERSION "4.2")/g' CMakeLists.txt
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
rm -rf build-asmjs
mkdir build-asmjs
cd build-asmjs
emcmake cmake .. -GNinja
ninja
ls -l
- name: Copy Spine 4.2 files to external directory
run: |
DIST_PATH="dist/4.2"
rm -rf $DIST_PATH
mkdir -p $DIST_PATH
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./$DIST_PATH/
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./$DIST_PATH/spine.wasm.js
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./$DIST_PATH/
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./$DIST_PATH/spine.asm.js
mkdir -p ./native/external/emscripten/spine/4.2/
echo "-------- Before replace spine wasm -----------"
ls -l ./native/external/emscripten/spine/4.2/
cp -f ./$DIST_PATH/* ./native/external/emscripten/spine/4.2/
echo "-------- After replace spine wasm ------------"
ls -l ./native/external/emscripten/spine/4.2/
echo "-----------------------------------------------"
cd ./native/external
git status
- name: npm install
run: |
npm install
- name: build-debug-infos
run: |
npm run build:debug-infos
- name: run test
run: |
export NODE_OPTIONS="--max-old-space-size=8192"
npm test