Skip to content

Commit a84b580

Browse files
committed
更新构建配置以支持新的 Linux x86和arm32v7 架构和改进文档说明。
1 parent a768479 commit a84b580

File tree

2 files changed

+62
-22
lines changed

2 files changed

+62
-22
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
include:
15+
# ----- Native Builds -----
1516
# ===== Linux =====
1617
- os: linux
1718
arch: x86_64
@@ -46,6 +47,18 @@ jobs:
4647
py_arch: arm64
4748
desc: macos-arm64
4849

50+
# ----- Emulated Builds (都运行在 ubuntu-22.04 x86_64 上) -----
51+
- os: linux
52+
arch: x86
53+
runs_on: ubuntu-22.04
54+
desc: linux-x86
55+
image: i386/debian:12 # 使用 Debian 12 作为替代
56+
- os: linux
57+
arch: armv7
58+
runs_on: ubuntu-22.04
59+
desc: linux-armv7
60+
image: arm32v7/ubuntu:22.04
61+
4962
runs-on: ${{ matrix.runs_on }}
5063

5164
permissions:
@@ -57,27 +70,61 @@ jobs:
5770
with:
5871
fetch-depth: 0
5972

60-
# 安装对应架构的 Python
61-
- name: Set up Python
73+
# ===================================================================
74+
# 分支 1: Native Builds (x86_64, arm64, windows, macos)
75+
# ===================================================================
76+
- name: Set up Python (Native)
77+
if: "!matrix.image" # 只在没有定义 matrix.image 的原生构建上运行
6278
uses: actions/setup-python@v5
6379
with:
6480
python-version: '3.12'
6581
architecture: ${{ matrix.py_arch }}
6682

67-
- name: Install dependencies
83+
- name: Install dependencies (Native)
84+
if: "!matrix.image"
6885
run: |
6986
python -m pip install --upgrade pip
7087
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
7188
pip install pyinstaller
7289
shell: bash
7390

74-
- name: Build with PyInstaller
91+
- name: Build with PyInstaller (Native)
92+
if: "!matrix.image"
7593
run: |
7694
mkdir -p dist
7795
pyinstaller --onefile --name TJUEcardSetup setup.py
7896
pyinstaller --onefile --noconsole --name TJUEcard TJUEcard_main.py
7997
shell: bash
8098

99+
# ===================================================================
100+
# 分支 2: Emulated Builds (x86, armv7)
101+
# ===================================================================
102+
- name: Set up QEMU
103+
if: "matrix.image" # 只在需要模拟的构建上运行
104+
uses: docker/setup-qemu-action@v3
105+
106+
- name: Build with PyInstaller (Emulated)
107+
if: "matrix.image"
108+
run: |
109+
# 在容器内执行所有安装和构建步骤
110+
docker run --rm --privileged \
111+
-v "${{ github.workspace }}":/workspace \
112+
-w /workspace \
113+
${{ matrix.image }} \
114+
sh -c " \
115+
set -ex; \
116+
apt-get update; \
117+
apt-get install -y python3 python3-pip git; \
118+
ln -s /usr/bin/python3 /usr/bin/python || true; \
119+
python -m pip install --upgrade pip; \
120+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi; \
121+
pip install pyinstaller; \
122+
pyinstaller --onefile --name TJUEcardSetup setup.py; \
123+
pyinstaller --onefile --noconsole --name TJUEcard TJUEcard_main.py \
124+
"
125+
126+
# ============ 从这里开始,所有分支的步骤合并 ============
127+
81128
# ===== 验证架构 =====
82129
- name: Check binary arch (Linux)
83130
if: runner.os == 'Linux'

README.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
| 操作系统 | 支持架构 |
6767
|---------------|-------------------------------------------|
6868
| Windows 10+ | x86_64 |
69-
| Ubuntu 22.04+ | x86_64, arm64 |
69+
| Ubuntu 22.04+ | x86_64, arm64, x86, arm32v7 |
7070
| ~~macOS 13+~~ | ~~x86_64 (Intel), arm64 (Apple Silicon)~~ |
7171

7272
> ⚠ 其他 Linux 发行版未经验证,不保证能正常使用。
@@ -181,31 +181,24 @@
181181

182182
- **查询定时任务**
183183

184-
打开终端,输入以下命令查看当前 root 用户的 `LaunchAgent` 任务列表:
184+
打开终端,输入以下命令查看当前 root 用户的 `crontab` 任务列表:
185185

186186
```zsh
187-
sudo launchctl list
187+
sudo crontab -l
188188
```
189189

190190
- **取消定时任务**
191191

192-
1. 使用 `launchctl bootout` 命令停止并移除任务:
192+
打开终端,输入以下命令编辑当前 root 用户的 `crontab` 文件,并移除包含 `TJUEcard` 的相关行:
193+
```zsh
194+
sudo crontab -e
195+
```
193196

194-
```zsh
195-
sudo launchctl bootout system /Library/LaunchDaemons/com.tjuecard.automatic.plist
196-
```
197+
验证是否已移除:
197198

198-
2. 找到对应的配置文件并删除:
199-
200-
```zsh
201-
sudo rm /Library/LaunchDaemons/com.tjuecard.automatic.plist
202-
```
203-
204-
3. 验证是否已移除:
205-
206-
```zsh
207-
sudo launchctl list | grep tjuecard
208-
```
199+
```zsh
200+
sudo crontab -l | grep TJUEcard
201+
```
209202

210203
## ❗注意事项
211204

0 commit comments

Comments
 (0)