chore: 使用新的CI流程 (#11)

* fix: wine environment

* fix: wine environment

* fix: environment

* perf: remove recommend

* fix: env

* Update release.yml

* fix: permission of wcsc.exe

* fix: 一处越界问题

* fix: pnpm install

* fix: wine prepare

* fix: wine cfg

* feat: error console

* fix: 兼容clang

* perf: 调整位置

* perf: 带入环境

* fix: version

* perf: log

* fix: version check

* fix: version
This commit is contained in:
msojocs 2025-01-22 16:55:30 +08:00 committed by GitHub
parent 002f1b4c33
commit 754a09886e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 1837 additions and 59 deletions

View File

@ -106,33 +106,19 @@ jobs:
- name: Prepare
run: |
set -x -u -o pipefail
source /etc/os-release
# Get rid of packages installed from ppa:ondrej/php so that we will be able to install wine32:i386 without conflicts
# (see issue https://github.com/actions/virtual-environments/issues/4589)
# In detail we:
# 1. Remove all packages that ppa:ondrej/php has but plain Ubuntu doesn't, e.g. everything PHP
# 2. Revert (remaining) packages that ppa:ondrej/php and plain Ubuntu share, back to the plain Ubuntu version
# 3. Assert that no packages from ppa:ondrej/php are left installed
dpkg -l | grep '^ii' | grep -F deb.sury.org | awk '{print $2}' | grep '^php' \
| xargs -r -t sudo apt-get remove --yes libpcre2-posix3 libzip4
dpkg -l | grep '^ii' | grep -F deb.sury.org | awk '{print $2}' | sed "s,\$,/${UBUNTU_CODENAME}," \
| xargs -r -t sudo apt-get install --yes --no-install-recommends --allow-downgrades -V
! dpkg -l | grep '^ii' | grep -F deb.sury.org
set -x
sudo apt update
sudo apt install -y wine64
sudo apt-add-repository universe
sudo apt upgrade -y
sudo dpkg --add-architecture i386
dpkg --print-foreign-architectures
sudo apt update
sudo apt install libwine
echo "install wine32..."
sudo apt install wine32
sudo apt-get install wine-binfmt
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt update
sudo apt install winehq-stable -y
sudo apt-get install wine-binfmt wine32 -y
sudo update-binfmts --import /usr/share/binfmts/wine
wine --version
corepack enable
ls -l
@ -144,20 +130,21 @@ jobs:
chmod +x build/*
ls -l build
node -v
pnpm install
pnpm install --no-frozen-lockfile
- name: Test
run: |
ls -l test/wine
# ./test/wine/wcc.exe
sudo apt install -y xvfb curl
pnpm run test-prepare
sudo apt install -y xvfb
ls -l build
ls -l test/runner/nwjs/wcc/build/Release
# fix: 预先运行,做一下配置,不然第一次执行会有问题
./test/wine/wcc.exe || true
./test/wine/wcc.exe -v || true
# 需要wine64
pnpm run test
# - uses: ./.github/actions/test
# with:
# who-to-greet: 'Mona the Octocat'
upload:
name: Create release and upload artifacts

3
.gitignore vendored
View File

@ -8,4 +8,5 @@ node_modules
*err.js
*stderr.json
.cache
*/spec/**/*output.js
*/spec/**/*output.js
tmp

1812
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ namespace WXSS
/* data */
public:
using STATE = int;
static int TT[26113];
static int TT[26114];
static bool bInited;
std::string offset_0; // 文件内容
std::string offset_24; // 文件路径

View File

@ -1300,7 +1300,7 @@ namespace WXML {
/* code */
if (j->second.offset_56 == -3)
{
if (a14 & 1 == 0)
if ((a14 & 1) == 0)
{
auto err = this->Error(a2, j->second, j->first, j->second.offset_60);
throw "RenderException" + err;

View File

@ -21,7 +21,7 @@ namespace WXSS
}
const char *DIRECTIVES[] = {"@import", "@charset", "@media", "@keyframes", "@-webkit-keyframes", "@supports", "nth-child", "nth-last-child", "nth-of-type", "nth-last-of-type"};
int Tokenizer::TT[26113] = {0};
int Tokenizer::TT[26114] = {0};
bool Tokenizer::bInited = false;
void Tokenizer::InitTransitTable(/* args */)
{

View File

@ -49,6 +49,7 @@ const wcc = (args: string[], projectPath: string): Promise<string> => {
args,
{
cwd: projectPath,
env: process.env,
}
);
const spwanData: any[] = [],
@ -69,11 +70,19 @@ const wcc = (args: string[], projectPath: string): Promise<string> => {
resolve(result);
} else {
process.stderr.write(
"wine error:" +
"wine error:\n" +
Buffer.concat(errData).toString()
);
process.stderr.write(
"stdout:\n" +
Buffer.concat(spwanData).toString()
);
// process.stderr.write(Buffer.concat(spwanData).toString());
reject(n);
reject({
code: n,
stdout: Buffer.concat(spwanData).toString(),
stderr: Buffer.concat(errData).toString(),
});
}
});
});

View File

@ -2,7 +2,7 @@
Xvfb :98 & # Start xvfb on display :98
export DISPLAY=:98
set -x
set -ex
root_dir=$(cd `dirname $0`/../../.. && pwd -P)
cur_dir=$(cd `dirname $0` && pwd -P)
@ -46,7 +46,7 @@ docker_start(){
--env=TZ=Asia/Shanghai\
--volume=winehome:/home/wineuser\
-p 8083:8083\
scottyhardy/docker-wine:stable-9.0-20240804\
scottyhardy/docker-wine\
wine /workspace/cache/nwjs-sdk-v$nw_version-win-x64/nw.exe
i=0

View File

@ -16,7 +16,11 @@ describe("wcc - empty", function () {
try
{
w = (await windows.wcc(args, projectPath)).replace(/\r\n/g, '\n')
}catch{}
}
catch(err: any){
console.error('error:', err)
w = err.stdout.replace(/\r\n/g, '\n')
}
const n = await linux.wcc(args, projectPath);
const storagePath = path.resolve(
__dirname,
@ -28,7 +32,7 @@ describe("wcc - empty", function () {
fs.writeFileSync(`${storagePath}/wine-output.js`, w);
fs.writeFileSync(`${storagePath}/node-output.js`, n);
assert.equal(w, n);
assert.equal(n, w, `wine: ${w}\n\nlinux: ${n}`);
});
});
});

0
test/wine/wcc.exe Normal file → Executable file
View File

0
test/wine/wcsc.exe Normal file → Executable file
View File

View File

@ -0,0 +1,2 @@
#!/bin/bash
sudo apt-get install -y libxdamage1 libxcomposite-dev libxkbcommon-x11-0 libcups2 libnss3-dev libxrandr2 libgbm-dev libpangocairo-1.0-0 libasound2 libatspi2.0-0

View File

@ -0,0 +1,5 @@
#!/bin/bash
root_dir=$(cd `dirname $0`/.. && pwd -P)