feat: 主控 1Shell AI 加安全模式开关 #52
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: CI · 1Shell 2.0 | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18, 20] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npm test | |
| env: | |
| APP_SECRET: ci-test-secret-key-for-testing | |
| APP_LOGIN_PASSWORD: ci-test-password | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Docker image | |
| run: docker build -t 1shell:test . | |
| - name: Verify container starts | |
| run: | | |
| docker run -d --name 1shell-test \ | |
| -e APP_SECRET=ci-test-secret \ | |
| -e APP_LOGIN_PASSWORD=ci-test-pw \ | |
| -p 3301:3301 \ | |
| 1shell:test | |
| sleep 5 | |
| curl -sf http://localhost:3301/api/health | grep -q '"status":"ok"' | |
| docker stop 1shell-test |