Skip to content

Commit

Permalink
CI Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzdyl committed Sep 26, 2024
1 parent c03ae0f commit dfe3473
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 24 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
- name: Check output and directory existence
run: |
if ! /opt/QQ/qq --logging-enable | grep -q "[LiteLoader]" || [ ! -d "/opt/LiteLoader/plugins" ]; then
echo "LiteLoader not found in output or /opt/LiteLoader/plugins directory does not exist. Test failed."
if ! /opt/QQ/qq --logging-enable | grep -q "[LiteLoader]" || [ ! -d "/opt/LiteLoader/data" ]; then
echo "LiteLoader not found in output or /opt/LiteLoader/data directory does not exist. Test failed."
exit 1
else
echo "LiteLoader found in output and /opt/LiteLoader/plugins directory exists. Test succeeded."
echo "LiteLoader found in output and /opt/LiteLoader/data directory exists. Test succeeded."
fi
- name: Set up iptables rules
Expand All @@ -71,11 +71,11 @@ jobs:
- name: Check output again
run: |
if ! /opt/QQ/qq --logging-enable | grep -q "[LiteLoader]" || [ ! -d "/opt/LiteLoader/plugins" ]; then
echo "LiteLoader not found in output or /opt/LiteLoader/plugins directory does not exist. Test failed."
if ! /opt/QQ/qq --logging-enable | grep -q "[LiteLoader]" || [ ! -d "/opt/LiteLoader/data" ]; then
echo "LiteLoader not found in output or /opt/LiteLoader/data directory does not exist. Test failed."
exit 1
else
echo "LiteLoader found in output and /opt/LiteLoader/plugins directory exists. Test succeeded."
echo "LiteLoader found in output and /opt/LiteLoader/data directory exists. Test succeeded."
fi
release:
Expand Down
14 changes: 3 additions & 11 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ jobs:
pkill QQ
# 检查 LiteLoader 插件是否存在
if [ -d "$HOME/Library/Containers/com.tencent.qq/Data/Documents/LiteLoader/plugins" ]; then
echo "LiteLoader plugins folder exists. Test succeeded."
if [ -d "$HOME/Library/Containers/com.tencent.qq/Data/Documents/LiteLoader/data" ]; then
echo "LiteLoader data folder exists. Test succeeded."
else
echo "LiteLoader plugins folder does not exist. Test failed."
echo "LiteLoader data folder does not exist. Test failed."
exit 1
fi
Expand Down Expand Up @@ -86,14 +86,6 @@ jobs:
# 关闭 QQ 应用程序,这里使用 pkill 假设 QQ 进程的名字为 QQ
pkill QQ
# 检查 LiteLoader 插件是否存在
if [ -d "$HOME/Library/Containers/com.tencent.qq/Data/Documents/LiteLoader/plugins" ]; then
echo "LiteLoader plugins folder exists. Test succeeded."
else
echo "LiteLoader plugins folder does not exist. Test failed."
exit 1
fi
release:
runs-on: ubuntu-latest
needs: install_and_test
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ jobs:
run: |
.\dist\install_windows_pyinstaller.exe
- name: Run QQ with logging
- name: Check QQNT Process
shell: pwsh
run: |
start "" "C:\Program Files\Tencent\QQNT\QQ.exe" --enable-logging
Start-Process -FilePath "C:\Program Files\Tencent\QQNT\QQ.exe" -ArgumentList '--enable-logging' -NoNewWindow
Start-Sleep -Seconds 5 # 等待 5 秒
Get-Process -Name "QQ" # 检查 QQ 进程是否在运行
- name: Check if LiteLoader plugins folder exists
run: |
Expand All @@ -69,6 +72,17 @@ jobs:
exit 1
}
- name: Delete LiteLoaderQQNT-main directory
run: |
# 检查目录是否存在
if (Test-Path "C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT") {
# 删除目录
Remove-Item -Recurse -Force "C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT"
Write-Output "Deleted: C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT"
} else {
Write-Output "Directory does not exist."
}
shell: pwsh
- name: Block GitHub access by modifying hosts file
run: |
echo 127.0.0.1 github.com | Out-File -Append -FilePath C:\Windows\System32\drivers\etc\hosts -Encoding ASCII
Expand All @@ -77,6 +91,10 @@ jobs:
- name: ReRun install_windows_pyinstaller.exe
run: |
.\dist\install_windows_pyinstaller.exe
- name: Start QQNT
shell: pwsh # 确保使用 PowerShell
run: |
Start-Process -FilePath "C:\Program Files\Tencent\QQNT\QQ.exe" -ArgumentList '--enable-logging'
- name: Create release body
if: github.event_name == 'push'
Expand Down Expand Up @@ -123,3 +141,4 @@ jobs:
dist/install_windows_pyinstaller.exe
env:
GITHUB_TOKEN: ${{ secrets.AC_TOKEN }}

7 changes: 5 additions & 2 deletions .github/workflows/windows_nuitka.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ jobs:
run: |
.\build\install_windows_nuitka.exe
- name: Run QQ with logging
- name: Check QQNT Process
shell: pwsh
run: |
start "" "C:\Program Files\Tencent\QQNT\QQ.exe" --enable-logging
Start-Process -FilePath "C:\Program Files\Tencent\QQNT\QQ.exe" -ArgumentList '--enable-logging' -NoNewWindow
Start-Sleep -Seconds 5 # 等待 5 秒
Get-Process -Name "QQ" # 检查 QQ 进程是否在运行
- name: Check if LiteLoader plugins folder exists
run: |
Expand Down
11 changes: 8 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,21 @@ function patch_index_js() {
echo "正在创建 $path/$file_name..."

# 写入 require(String.raw`*`) 到 *.js 文件
echo "require(String.raw\`$ll_path/LiteLoader\`);" > "$path/$file_name"
# $sudo_cmd echo "require(String.raw\`$ll_path/LiteLoader\`);" > "$path/$file_name"
echo "require(String.raw\`$ll_path/LiteLoader\`);" | $sudo_cmd tee "$path/$file_name" > /dev/null
echo "已创建 $path/$file_name,内容为 require(String.raw\`$ll_path/LiteLoader\`)"

# 检查 package.json 文件是否存在
local package_json="$path/../package.json"
if [ -f "$package_json" ]; then
echo "正在修改 $package_json 的 main 字段..."

# 修改 package.json 中的 main 字段为 ./app_launcher/launcher.js
$sudo_cmd sed -i '' 's|"main":.*|"main": "./app_launcher/'"$file_name"'",|' "$package_json"
if [ "$platform" == "linux" ]; then
$sudo_cmd sed -i 's|"main":.*|"main": "./app_launcher/'"$file_name"'",|' "$package_json"
elif [ "$platform" == "macos" ]; then
# 修改 package.json 中的 main 字段为 ./app_launcher/launcher.js
$sudo_cmd sed -i '' 's|"main":.*|"main": "./app_launcher/'"$file_name"'",|' "$package_json"
fi

echo "已将 $package_json 中的 main 字段修改为 ./app_launcher/$file_name"
else
Expand Down

0 comments on commit dfe3473

Please sign in to comment.