Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

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