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.
 
 
 
 
 
 

143 lines
4.4 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@v10"
  26. with:
  27. versions: 3.10:latest, 3.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. pip install frappe-bench
  88. pyenv global $(pyenv versions | grep '3.10')
  89. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  90. env:
  91. DB: mariadb
  92. TYPE: server
  93. - name: Run Patch Tests
  94. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  95. run: |
  96. cd ~/frappe-bench/
  97. wget https://frappeframework.com/files/v10-frappe.sql.gz
  98. bench --site test_site --force restore ~/frappe-bench/v10-frappe.sql.gz
  99. source env/bin/activate
  100. cd apps/frappe/
  101. git remote set-url upstream https://github.com/frappe/frappe.git
  102. pyenv global $(pyenv versions | grep '3.7')
  103. for version in $(seq 12 13)
  104. do
  105. echo "Updating to v$version"
  106. branch_name="version-$version-hotfix"
  107. git fetch --depth 1 upstream $branch_name:$branch_name
  108. git checkout -q -f $branch_name
  109. pip install -U frappe-bench
  110. rm -rf ~/frappe-bench/env
  111. bench -v setup env
  112. bench --site test_site migrate
  113. done
  114. echo "Updating to last commit"
  115. git checkout -q -f "$GITHUB_SHA"
  116. pyenv global $(pyenv versions | grep '3.10')
  117. rm -rf ~/frappe-bench/env
  118. bench -v setup env
  119. bench --site test_site migrate