feat: wcc module

This commit is contained in:
msojocs 2024-07-07 10:08:33 +08:00
parent e95371e22f
commit a3b858e143
8 changed files with 51 additions and 25 deletions

View File

@ -151,6 +151,8 @@ jobs:
# ./test/wine/wcc.exe # ./test/wine/wcc.exe
pnpm run test-prepare pnpm run test-prepare
sudo apt install -y xvfb sudo apt install -y xvfb
ls -l build
ls -l test/runner/nwjs/wcc/build/Release
# pnpm run test # pnpm run test
- uses: ./.github/actions/test - uses: ./.github/actions/test
with: with:

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
build /build
cache cache
test/*.json test/*.json
wcc.exe.c wcc.exe.c

1
test/node-gyp/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build

View File

@ -30,33 +30,54 @@ fi
rm -rf "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64/package.nw" rm -rf "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64/package.nw"
cp -r "$cur_dir/package.nw" "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64" cp -r "$cur_dir/package.nw" "$root_dir/cache/nwjs-sdk-v$nw_version-win-x64"
docker run -d -i\ docker_start(){
--volume=$root_dir:/workspace\ docker run -d -i\
--env=USE_XVFB=yes\ --rm\
--env=XVFB_SERVER=:95\ --volume=$root_dir:/workspace\
--env=XVFB_SCREEN=0\ --env=USE_XVFB=yes\
--env=XVFB_RESOLUTION=320x240x8\ --env=XVFB_SERVER=:95\
--env=DISPLAY=:95\ --env=XVFB_SCREEN=0\
--hostname=DESKTOP-1TV4OA1\ --env=XVFB_RESOLUTION=320x240x8\
--name=wine\ --env=DISPLAY=:95\
--shm-size=1g\ --hostname=DESKTOP-1TV4OA1\
--workdir=/home/wineuser\ --name=wine\
--env=TZ=Asia/Shanghai\ --shm-size=1g\
--volume=winehome:/home/wineuser\ --workdir=/home/wineuser\
-p 8083:8083\ --env=TZ=Asia/Shanghai\
scottyhardy/docker-wine:latest\ --volume=winehome:/home/wineuser\
wine /workspace/cache/nwjs-sdk-v$nw_version-win-x64/nw.exe -p 8083:8083\
i=0 scottyhardy/docker-wine:latest\
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:8083/check); do wine /workspace/cache/nwjs-sdk-v$nw_version-win-x64/nw.exe
printf '.'
curl http://127.0.0.1:8083/check i=0
sleep 1 until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:8083/check); do
let i=$i+1 printf '.'
if [ $i -ge 50 ];then curl http://127.0.0.1:8083/check
echo "error" sleep 1
let i=$i+1
if [ $i -ge 50 ];then
echo "error"
docker ps -a
docker logs wine
return 1
fi
done
return 0
}
for ((i=0; i<5; i++));
do
ret=$(docker_start)
if [ "$ret" -eq 0 ];then
echo "Docker started successfully."
break
fi
if [ "$i" -eq 4 ];then
echo "Failed to start Docker after 5 attempts."
docker ps -a docker ps -a
docker logs wine docker logs wine
exit 1 exit 1
fi fi
sleep 1
done done
echo "success" echo "success"

Binary file not shown.

View File

@ -0,0 +1 @@
../../../../../../build/wcc_module.node

View File

@ -0,0 +1 @@
../../../../../../build/wcsc_module.node