Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

145 řádky
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. mariadb:
  15. image: mariadb:10.6
  16. env:
  17. MARIADB_ROOT_PASSWORD: travis
  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: Check if build should be run
  25. id: check-build
  26. run: |
  27. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  28. env:
  29. TYPE: "server"
  30. PR_NUMBER: ${{ github.event.number }}
  31. REPO_NAME: ${{ github.repository }}
  32. - name: Setup Python
  33. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  34. uses: "gabrielfalcao/pyenv-action@v10"
  35. with:
  36. versions: 3.10:latest, 3.7:latest
  37. - name: Setup Node
  38. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  39. uses: actions/setup-node@v3
  40. with:
  41. node-version: 14
  42. check-latest: true
  43. - name: Add to Hosts
  44. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  45. run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  46. - name: Cache pip
  47. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  48. uses: actions/cache@v3
  49. with:
  50. path: ~/.cache/pip
  51. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  52. restore-keys: |
  53. ${{ runner.os }}-pip-
  54. ${{ runner.os }}-
  55. - name: Cache node modules
  56. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  57. uses: actions/cache@v3
  58. env:
  59. cache-name: cache-node-modules
  60. with:
  61. path: ~/.npm
  62. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  63. restore-keys: |
  64. ${{ runner.os }}-build-${{ env.cache-name }}-
  65. ${{ runner.os }}-build-
  66. ${{ runner.os }}-
  67. - name: Get yarn cache directory path
  68. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  69. id: yarn-cache-dir-path
  70. run: echo "::set-output name=dir::$(yarn cache dir)"
  71. - uses: actions/cache@v3
  72. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  73. id: yarn-cache
  74. with:
  75. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  76. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  77. restore-keys: |
  78. ${{ runner.os }}-yarn-
  79. - name: Install Dependencies
  80. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  81. run: bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  82. env:
  83. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  84. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  85. TYPE: server
  86. - name: Install
  87. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  88. run: |
  89. pip install frappe-bench
  90. pyenv global $(pyenv versions | grep '3.10')
  91. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  92. env:
  93. DB: mariadb
  94. TYPE: server
  95. - name: Run Patch Tests
  96. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  97. run: |
  98. cd ~/frappe-bench/
  99. wget https://frappeframework.com/files/v10-frappe.sql.gz
  100. bench --site test_site --force restore ~/frappe-bench/v10-frappe.sql.gz
  101. source env/bin/activate
  102. cd apps/frappe/
  103. git remote set-url upstream https://github.com/frappe/frappe.git
  104. pyenv global $(pyenv versions | grep '3.7')
  105. for version in $(seq 12 13)
  106. do
  107. echo "Updating to v$version"
  108. branch_name="version-$version-hotfix"
  109. git fetch --depth 1 upstream $branch_name:$branch_name
  110. git checkout -q -f $branch_name
  111. pip install -U frappe-bench
  112. rm -rf ~/frappe-bench/env
  113. bench -v 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 -v setup env
  121. bench --site test_site migrate