feat: fully automatic installation on pip install #4
This file contains hidden or 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: Test Installation | |
| on: | |
| push: | |
| branches: [ main, master, dev ] | |
| pull_request: | |
| branches: [ main, master, dev ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test on ${{ matrix.os }} - Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ['3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up Node.js (required for Serverless Devs) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install package (will auto-install Serverless Devs) | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| - name: Verify Python package | |
| run: | | |
| python -c "import serverless_devs; print('✓ Package version:', serverless_devs.__version__)" | |
| - name: Verify Serverless Devs installation | |
| shell: bash | |
| run: | | |
| # 等待一下,确保安装完成 | |
| sleep 5 | |
| # 在某些系统上可能需要刷新环境 | |
| if [ "$RUNNER_OS" == "macOS" ] || [ "$RUNNER_OS" == "Linux" ]; then | |
| export PATH="$HOME/.local/bin:$PATH" | |
| # 检查常见的安装位置 | |
| if [ -f "$HOME/.s/bin/s" ]; then | |
| export PATH="$HOME/.s/bin:$PATH" | |
| fi | |
| fi | |
| # 检查 s 命令 | |
| if command -v s &> /dev/null; then | |
| echo "✓ s command found" | |
| s --version | |
| else | |
| echo "✗ s command not found in PATH" | |
| echo "Checking npm global bin..." | |
| npm root -g | |
| npm list -g @serverless-devs/s || true | |
| exit 1 | |
| fi | |
| - name: Test s command via Python wrapper | |
| run: | | |
| python -m serverless_devs --version |