You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

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