您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

132 行
4.0 KiB

  1. name: Patch
  2. on: [pull_request, workflow_dispatch]
  3. concurrency:
  4. group: patch-mariadb-develop-${{ github.event.number }}
  5. cancel-in-progress: true
  6. jobs:
  7. test:
  8. runs-on: ubuntu-latest
  9. timeout-minutes: 60
  10. name: Patch Test
  11. services:
  12. mysql:
  13. image: mariadb:10.3
  14. env:
  15. MYSQL_ALLOW_EMPTY_PASSWORD: YES
  16. ports:
  17. - 3306:3306
  18. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  19. steps:
  20. - name: Clone
  21. uses: actions/checkout@v2
  22. - name: Setup Python
  23. uses: actions/setup-python@v2
  24. with:
  25. python-version: '3.9'
  26. - name: Setup Node
  27. uses: actions/setup-node@v2
  28. with:
  29. node-version: 14
  30. check-latest: true
  31. - name: Check if build should be run
  32. id: check-build
  33. run: |
  34. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  35. env:
  36. TYPE: "server"
  37. PR_NUMBER: ${{ github.event.number }}
  38. REPO_NAME: ${{ github.repository }}
  39. - name: Add to Hosts
  40. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  41. run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  42. - name: Cache pip
  43. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  44. uses: actions/cache@v2
  45. with:
  46. path: ~/.cache/pip
  47. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  48. restore-keys: |
  49. ${{ runner.os }}-pip-
  50. ${{ runner.os }}-
  51. - name: Cache node modules
  52. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  53. uses: actions/cache@v2
  54. env:
  55. cache-name: cache-node-modules
  56. with:
  57. path: ~/.npm
  58. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  59. restore-keys: |
  60. ${{ runner.os }}-build-${{ env.cache-name }}-
  61. ${{ runner.os }}-build-
  62. ${{ runner.os }}-
  63. - name: Get yarn cache directory path
  64. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  65. id: yarn-cache-dir-path
  66. run: echo "::set-output name=dir::$(yarn cache dir)"
  67. - uses: actions/cache@v2
  68. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  69. id: yarn-cache
  70. with:
  71. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  72. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  73. restore-keys: |
  74. ${{ runner.os }}-yarn-
  75. - name: Install Dependencies
  76. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  77. run: bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  78. env:
  79. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  80. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  81. TYPE: server
  82. - name: Install
  83. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  84. run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  85. env:
  86. DB: mariadb
  87. TYPE: server
  88. - name: Run Patch Tests
  89. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  90. run: |
  91. cd ~/frappe-bench/
  92. wget https://frappeframework.com/files/v10-frappe.sql.gz
  93. bench --site test_site --force restore ~/frappe-bench/v10-frappe.sql.gz
  94. source env/bin/activate
  95. cd apps/frappe/
  96. git remote set-url upstream https://github.com/frappe/frappe.git
  97. for version in $(seq 12 13)
  98. do
  99. echo "Updating to v$version"
  100. branch_name="version-$version-hotfix"
  101. git fetch --depth 1 upstream $branch_name:$branch_name
  102. git checkout -q -f $branch_name
  103. pip install -q -r requirements.txt
  104. bench --site test_site migrate
  105. done
  106. echo "Updating to last commit"
  107. git checkout -q -f "$GITHUB_SHA"
  108. bench setup requirements --python
  109. bench --site test_site migrate