fix: the bug when running command need sudo. 添加特权操作支持,封装sudo命令以简化权限管理 #55
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: npm run electron | |
| on: | |
| push: | |
| branches: | |
| - run* | |
| - test* | |
| - release* | |
| paths-ignore: | |
| - "_script/**" | |
| - "doc/**" | |
| - "**/*.md" | |
| - "**/.gitignore" | |
| - "**/LICENSE" | |
| jobs: | |
| npm-run-electron: | |
| runs-on: ${{ matrix.os }}-latest | |
| env: | |
| ELECTRON_CACHE: ${{ github.workspace }}/.cache/electron | |
| ELECTRON_BUILDER_CACHE: ${{ github.workspace }}/.cache/electron-builder | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - windows | |
| - ubuntu | |
| - macos | |
| node: | |
| - 22 | |
| steps: | |
| - name: Checkout | |
| uses: actions/[email protected] | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: 'Setup Node.js "${{ matrix.node }}.x" environment' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| registry-url: https://npm.pkg.github.com/ | |
| cache: pnpm | |
| - name: Setup Python environment (Mac) Because of electron-builder install-app-deps requires Python setup tools | |
| if: matrix.os == 'macos' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Print | |
| run: | | |
| echo "github.ref_type = ${{ github.ref_type }}"; | |
| echo "github.ref = ${{ github.ref }}"; | |
| echo "github.ref_name = ${{ github.ref_name }}"; | |
| - name: "npm -v | pnpm -v | python --version" | |
| run: | | |
| echo "======================================================================"; | |
| echo "npm -v"; | |
| echo "--------------------"; | |
| npm -v; | |
| echo "======================================================================"; | |
| echo "pnpm -v"; | |
| echo "--------------------"; | |
| pnpm -v; | |
| echo "======================================================================"; | |
| echo "python --version"; | |
| echo "--------------------"; | |
| python --version; | |
| - name: Setup electron cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.cache/electron | |
| key: ${{ runner.os }}-electron-cache-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-electron-cache- | |
| - name: Setup electron-builder cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ github.workspace }}/.cache/electron-builder | |
| key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-electron-builder-cache- | |
| - name: pnpm install | |
| run: | | |
| echo "======================================================================"; | |
| dir || ls -lah; | |
| echo "======================================================================"; | |
| echo "pnpm install"; | |
| echo "--------------------"; | |
| pnpm install; | |
| - name: npm run electron (auto-exit after 30min) | |
| run: | | |
| echo "======================================================================"; | |
| echo "electron with timeout"; | |
| echo "--------------------"; | |
| node _script/run-electron-with-timeout.js packages/gui 5 |