88 workflow_dispatch :
99
1010jobs :
11- test :
12- name : Test on ${{ matrix.os }} - Python ${{ matrix.python-version }}
11+ # 阶段1: 快速测试包本身
12+ test-package :
13+ name : Quick test - ${{ matrix.os }} - Python ${{ matrix.python-version }}
1314 runs-on : ${{ matrix.os }}
1415 strategy :
1516 fail-fast : false
@@ -18,55 +19,50 @@ jobs:
1819 python-version : ['3.10', '3.11', '3.12']
1920
2021 steps :
21- - name : Checkout code
22- uses : actions/checkout@v4
22+ - uses : actions/checkout@v4
2323
24- - name : Set up Python ${{ matrix.python-version }}
24+ - name : Set up Python
2525 uses : actions/setup-python@v5
2626 with :
2727 python-version : ${{ matrix.python-version }}
2828
29- - name : Set up Node.js (required for Serverless Devs)
29+ - name : Install and test package
30+ run : |
31+ pip install .
32+ python -c "import serverless_devs; print('✓ Version:', serverless_devs.__version__)"
33+ python -c "from serverless_devs.installer import install_serverless_devs; print('✓ Installer module OK')"
34+
35+ # 阶段2: 完整安装测试(仅在 Ubuntu 和 macOS 上测试,更快)
36+ test-full-installation :
37+ name : Full installation test - ${{ matrix.os }}
38+ runs-on : ${{ matrix.os }}
39+ needs : test-package
40+ strategy :
41+ fail-fast : false
42+ matrix :
43+ os : [ubuntu-latest, macos-latest]
44+ python-version : ['3.10', '3.12']
45+
46+ steps :
47+ - uses : actions/checkout@v4
48+
49+ - name : Set up Python
50+ uses : actions/setup-python@v5
51+ with :
52+ python-version : ${{ matrix.python-version }}
53+
54+ - name : Set up Node.js
3055 uses : actions/setup-node@v4
3156 with :
3257 node-version : ' 18'
3358
34- - name : Install package (will auto-install Serverless Devs)
35- run : |
36- python -m pip install --upgrade pip
37- pip install -e .
38-
39- - name : Verify Python package
40- run : |
41- python -c "import serverless_devs; print('✓ Package version:', serverless_devs.__version__)"
42-
43- - name : Verify Serverless Devs installation
44- shell : bash
59+ - name : Install package and Serverless Devs
4560 run : |
46- # 等待一下,确保安装完成
47- sleep 5
48-
49- # 在某些系统上可能需要刷新环境
50- if [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then
51- export PATH="$HOME/.local/bin:$PATH"
52- # 检查常见的安装位置
53- if [ -f "$HOME/.s/bin/s" ]; then
54- export PATH="$HOME/.s/bin:$PATH"
55- fi
56- fi
57-
58- # 检查 s 命令
59- if command -v s &> /dev/null; then
60- echo "✓ s command found"
61- s --version
62- else
63- echo "✗ s command not found in PATH"
64- echo "Checking npm global bin..."
65- npm root -g
66- npm list -g @serverless-devs/s || true
67- exit 1
68- fi
61+ pip install .
62+ python -m serverless_devs.installer --non-interactive
6963
70- - name : Test s command via Python wrapper
64+ - name : Verify installation
7165 run : |
72- python -m serverless_devs --version
66+ export PATH="$(npm bin -g):$PATH"
67+ s --version
68+ echo "✓ Full installation test passed"
0 commit comments