-
Notifications
You must be signed in to change notification settings - Fork 2k
142 lines (132 loc) · 4.73 KB
/
native-unit-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
name: <Native> Run Unit Tests
on:
pull_request:
paths:
- 'templates/**'
- 'native/**'
# 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:
unit-test-with-cmake:
name: "Run on macOS"
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: macos-latest
defaults:
run:
working-directory: ${{github.workspace}}/native
steps:
- uses: actions/checkout@v4
- uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.28.3
- name: Check cmake version
run: |
echo "CMake version: "
cmake --version
- name: Download external libraries
shell: bash
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 external
- name: Run Unit Tests
shell: bash
run: |
cpus=$(sysctl hw.ncpu | awk '{print $2}')
echo "cpus: ${cpus}"
which cmake
cmake --version
cmake -B tests/unit-test/build -S tests/unit-test -GXcode
cd tests/unit-test/build
# cmake --build tests/unit-test/build --config Release -j${cpus}
ls -l
xcodebuild -project CocosTest.xcodeproj -scheme "CocosTest" -jobs ${cpus} -arch arm64 -configuration Release build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
./src/Release/CocosTest
#### TODO(PatriceJiang): model split
# - name: Run Module Tests
# shell: bash
# run: |
# cd tests/module-tests
# bash run-test-windows.sh
sebind-with-windows:
name: "sebind tests"
if:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
runs-on: windows-latest
defaults:
run:
working-directory: ${{github.workspace}}/native
steps:
- uses: actions/checkout@v4
- name: Download external libraries
shell: bash
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 external
- name: Generate bindings
run: |
cd ./tools/swig-config
echo "Create auto-generated jsbinding glue codes."
node genbindings.js
git status
- name: Run Sebind Tests
shell: bash
run: |
cd ${GITHUB_WORKSPACE}/native
cp -r ../templates/windows tests/sebind-tests/win64
cd tests/sebind-tests
mkdir -p proj
cp cfg.cmake proj/
GW="${GITHUB_WORKSPACE//\\/\/}"
cmake -B proj -S win64 -DRES_DIR="${GW}/native/tests/sebind-tests" -DCOCOS_X_PATH="${GW}/native" -DAPP_NAME=sebind
cmake --build proj -j2
# cd proj/Debug
## can not boot on this machine
# ./sebind.exe || true
# if [[ -f "result.txt" ]];
# then
# echo "success!"
# else
# echo "Run sebind-tests fail!"
# exit 1
# fi
# sebind-run-on-linux:
# name: "Test sebind on Ubuntu"
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Download external libraries
# shell: bash
# 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: Generate bindings
# run: |
# cd ./native/tools/swig-config
# node genbindings.js
# git status
# - name: Install dependencies
# run: |
# sudo apt install libx11-dev -y
# sudo apt install libsndio-dev -y
# sudo apt install ninja-build -y
# - name: Run Sebind Tests
# shell: bash
# run: |
# cd ${GITHUB_WORKSPACE}/native
# cp -r ../templates/linux tests/sebind-tests/linux
# cd tests/sebind-tests
# mkdir -p proj
# cp cfg.cmake proj
# cmake -G Ninja -B proj -S linux -DRES_DIR=${GITHUB_WORKSPACE}/native/tests/sebind-tests/ -DCOCOS_X_PATH=${GITHUB_WORKSPACE}/native -DAPP_NAME=sebind
# cmake --build proj
# cd proj
# ./sebind || true
# if [[ -f "result.txt" ]];
# then
# echo "success!"
# else
# echo "Run sebind-tests fail!" > /dev/stderr
# fi