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.
 
 
 
 
 
 

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