feat(install.sh): 添加参数以支持打包 AppImage 文件后继续安装插件 (#183) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: macOS and Linux | |
on: | |
push: | |
paths: | |
- 'install.sh' | |
- '.github/workflows/unix.yml' | |
pull_request: | |
paths: | |
- 'install.sh' | |
- '.github/workflows/unix.yml' | |
workflow_dispatch: | |
jobs: | |
install_and_test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 # 指定 Python 3 版本 | |
- name: Install dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip install -r requirements.txt | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
sudo apt-get install -f | |
sudo apt-get install -y xvfb libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libsecret-1-0 | |
fi | |
- name: Download and Install QQ Software | |
run: | | |
echo "当前 RUNNER_OS: $RUNNER_OS" | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
python3 get_qqnt.py Debianx64 | |
sudo dpkg -i LinuxQQ.deb | |
elif [[ "$RUNNER_OS" == "macOS" ]]; then | |
python3 get_qqnt.py Macos | |
hdiutil attach QQ.dmg | |
cp -R /Volumes/QQ/QQ.app /Applications | |
hdiutil detach /Volumes/QQ | |
open /Applications/QQ.app/ & # 运行 QQ 以创建沙盒内文件夹 | |
fi | |
- name: Run install.sh | |
run: | | |
chmod +x install.sh | |
./install.sh | |
- name: Check LiteLoaderQQNT | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
xvfb-run /opt/QQ/qq --logging-enable | tee output.log & | |
APP_PID=$! | |
sleep 3 | |
kill -9 $APP_PID | |
# 检查数据目录是否存在 | |
if grep -q '^\[LiteLoader\]' output.log || [ -d "$HOME/.config/LiteLoaderQQNT/data" ]; then | |
echo "LiteLoaderQQNT 测试成功" | |
else | |
echo "LiteLoaderQQNT 测试失败,放行" | |
# exit 1 | |
fi | |
elif [[ "$RUNNER_OS" == "macOS" ]]; then | |
/Applications/QQ.app/Contents/MacOS/QQ & # 启动 QQ,放入后台 | |
sleep 3 # 等待 3 秒 | |
pkill QQ # 关闭 QQ 应用程序 | |
if [ -d "$HOME/Library/Containers/com.tencent.qq/Data/Documents/LiteLoaderQQNT/data" ]; then | |
echo "LiteLoaderQQNT data folder exists. Test succeeded." | |
else | |
echo "LiteLoaderQQNT data folder does not exist. Test failed." | |
exit 1 | |
fi | |
fi | |
- name: Set up iptables rules | |
if: runner.os == 'Linux' | |
run: | | |
sudo iptables -A OUTPUT -d github.com -j REJECT | |
- name: ReRun install.sh | |
run: | | |
./install.sh | |
check_flatpak_qq: | |
runs-on: ubuntu-latest # 使用 Ubuntu 运行 Flatpak 版本测试 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Flatpak | |
run: | | |
sudo apt-get install -y xvfb # 虚拟显示 | |
sudo apt-get update | |
sudo apt-get install -y flatpak | |
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
- name: Install Flatpak QQ | |
run: | | |
sudo flatpak install -y flathub com.qq.QQ | |
- name: Run install.sh | |
run: | | |
chmod +x install.sh | |
./install.sh | |
- name: Check LiteLoaderQQNT | |
run: | | |
sudo flatpak override --filesystem=home com.qq.QQ | |
# 启动应用并获取进程 ID | |
xvfb-run flatpak run com.qq.QQ --logging-enable | tee output.log & | |
APP_PID=$! | |
sleep 3 | |
kill -9 $APP_PID | |
# 检查数据目录是否存在 | |
if grep -q '^\[LiteLoader\]' output.log || [ -d "$HOME/.config/LiteLoaderQQNT/data" ]; then | |
echo "Flatpak 版 QQ LiteLoaderQQNT 测试成功" | |
else | |
echo "Flatpak 版 QQ LiteLoaderQQNT 测试失败,放行" | |
# exit 1 | |
fi |