fix: linux fish shell config err (#197) #88
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: | |
concurrency: | |
group: unix | |
cancel-in-progress: false | |
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 版本 | |
cache: 'pip' | |
- name: Install dependencies (Python) | |
run: | | |
python3 -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Cache (apt) | |
if: runner.os == 'Linux' | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: xvfb libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libsecret-1-0 | |
version: ${{ runner.os }} | |
- name: Install dependencies (apt) | |
if: runner.os == 'Linux' | |
run: sudo apt-get install xvfb libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libsecret-1-0 -y | |
- name: Restore Cache (QQ) | |
uses: actions/cache/restore@v4 | |
with: | |
path: QQ | |
key: QQ-${{ runner.os }}-${{ runner.arch }} | |
- 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: Save Cache (QQ) | |
uses: actions/cache/save@v4 | |
with: | |
path: QQ | |
key: QQ-${{ runner.os }}-${{ runner.arch }} | |
- name: Run install.sh | |
run: | | |
chmod +x install.sh | |
[[ "$RUNNER_OS" != "Linux" ]] && param='-k' | |
./install.sh $param | |
- 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: | | |
[[ "$RUNNER_OS" != "Linux" ]] && param='-k' | |
./install.sh $param | |
check_flatpak_qq: | |
runs-on: ubuntu-latest # 使用 Ubuntu 运行 Flatpak 版本测试 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Cache (apt) | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: xvfb flatpak | |
version: flatpak | |
- name: Install dependencies (apt) | |
run: sudo apt-get install xvfb flatpak -y | |
- name: Install Flatpak QQ | |
run: | | |
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
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 |