ci.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. name: Build and Test
  2. on:
  3. push:
  4. branches: [main, develop]
  5. pull_request:
  6. branches: [main, develop]
  7. jobs:
  8. build-and-test:
  9. runs-on: windows-latest
  10. strategy:
  11. matrix:
  12. node-version: [20.x]
  13. steps:
  14. - name: Checkout code
  15. uses: actions/checkout@v4
  16. - name: Setup Node.js ${{ matrix.node-version }}
  17. uses: actions/setup-node@v4
  18. with:
  19. node-version: ${{ matrix.node-version }}
  20. - name: Setup pnpm
  21. uses: pnpm/action-setup@v4
  22. with:
  23. version: 9.9.0
  24. run_install: false
  25. - name: Get pnpm store directory
  26. shell: bash
  27. run: |
  28. echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
  29. - name: Setup pnpm cache
  30. uses: actions/cache@v4
  31. with:
  32. path: ${{ env.STORE_PATH }}
  33. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  34. restore-keys: |
  35. ${{ runner.os }}-pnpm-store-
  36. - name: Install dependencies (workspace recursive)
  37. run: pnpm -r install --frozen-lockfile
  38. - name: Test WeChat Mini Program dev mode
  39. shell: bash
  40. run: |
  41. echo "Testing WeChat Mini Program dev mode startup..."
  42. timeout 30s pnpm dev:mp-weixin || true
  43. echo "✅ WeChat Mini Program dev mode test completed"
  44. - name: Test H5 dev mode
  45. shell: bash
  46. run: |
  47. echo "Testing H5 dev mode startup..."
  48. timeout 30s pnpm dev:h5 || true
  49. echo "✅ H5 dev mode test completed"
  50. - name: Test iOS dev mode
  51. shell: bash
  52. run: |
  53. echo "Testing iOS dev mode startup..."
  54. timeout 30s pnpm dev:app-ios || true
  55. echo "✅ iOS dev mode test completed"
  56. - name: Build WeChat Mini Program
  57. run: pnpm build:mp-weixin
  58. - name: Build H5
  59. run: pnpm build:h5
  60. - name: Build iOS
  61. run: pnpm build:app-ios
  62. - name: Upload WeChat Mini Program artifacts
  63. uses: actions/upload-artifact@v4
  64. with:
  65. name: wechat-miniprogram-build
  66. path: dist/build/mp-weixin/
  67. retention-days: 7
  68. - name: Upload H5 artifacts
  69. uses: actions/upload-artifact@v4
  70. with:
  71. name: h5-build
  72. path: dist/build/h5/
  73. retention-days: 7
  74. - name: Upload iOS artifacts
  75. uses: actions/upload-artifact@v4
  76. with:
  77. name: ios-build
  78. path: dist/build/app-ios/
  79. retention-days: 7
  80. - name: Build summary
  81. run: |
  82. echo "## Build and Test Summary" >> $GITHUB_STEP_SUMMARY
  83. echo "### Development Mode Tests" >> $GITHUB_STEP_SUMMARY
  84. echo "✅ WeChat Mini Program dev mode test completed" >> $GITHUB_STEP_SUMMARY
  85. echo "✅ H5 dev mode test completed" >> $GITHUB_STEP_SUMMARY
  86. echo "✅ iOS dev mode test completed" >> $GITHUB_STEP_SUMMARY
  87. echo "### Build Results" >> $GITHUB_STEP_SUMMARY
  88. echo "✅ WeChat Mini Program build completed" >> $GITHUB_STEP_SUMMARY
  89. echo "✅ H5 build completed" >> $GITHUB_STEP_SUMMARY
  90. echo "✅ iOS build completed" >> $GITHUB_STEP_SUMMARY
  91. echo "📦 All artifacts uploaded successfully" >> $GITHUB_STEP_SUMMARY
  92. - name: Build Docs (VitePress)
  93. run: pnpm -C docs run docs:build
  94. - name: Upload Docs artifacts
  95. uses: actions/upload-artifact@v4
  96. with:
  97. name: docs-build
  98. path: docs/.vitepress/dist/
  99. retention-days: 7