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.
 
 
 
 
 
 

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