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.
 
 
 
 
 
 

150 lines
4.9 KiB

  1. name: Server (MariaDB)
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. concurrency:
  6. group: patch-mariadb-develop-${{ github.event.number }}
  7. cancel-in-progress: true
  8. permissions:
  9. # Do not change this as GITHUB_TOKEN is being used by roulette
  10. contents: read
  11. jobs:
  12. test:
  13. name: Patch
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 60
  16. services:
  17. mariadb:
  18. image: mariadb:10.6
  19. env:
  20. MARIADB_ROOT_PASSWORD: travis
  21. ports:
  22. - 3306:3306
  23. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  24. steps:
  25. - name: Clone
  26. uses: actions/checkout@v3
  27. - name: Check for valid Python & Merge Conflicts
  28. run: |
  29. python -m compileall -f "${GITHUB_WORKSPACE}"
  30. if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
  31. then echo "Found merge conflicts"
  32. exit 1
  33. fi
  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. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  43. - name: Setup Python
  44. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  45. uses: "gabrielfalcao/pyenv-action@v10"
  46. with:
  47. versions: 3.10:latest, 3.7:latest
  48. - name: Setup Node
  49. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  50. uses: actions/setup-node@v3
  51. with:
  52. node-version: 16
  53. check-latest: true
  54. - name: Add to Hosts
  55. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  56. run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  57. - name: Cache pip
  58. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  59. uses: actions/cache@v3
  60. with:
  61. path: ~/.cache/pip
  62. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  63. restore-keys: |
  64. ${{ runner.os }}-pip-
  65. ${{ runner.os }}-
  66. - name: Cache node modules
  67. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  68. uses: actions/cache@v3
  69. env:
  70. cache-name: cache-node-modules
  71. with:
  72. path: ~/.npm
  73. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  74. restore-keys: |
  75. ${{ runner.os }}-build-${{ env.cache-name }}-
  76. ${{ runner.os }}-build-
  77. ${{ runner.os }}-
  78. - name: Get yarn cache directory path
  79. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  80. id: yarn-cache-dir-path
  81. run: echo "::set-output name=dir::$(yarn cache dir)"
  82. - uses: actions/cache@v3
  83. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  84. id: yarn-cache
  85. with:
  86. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  87. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  88. restore-keys: |
  89. ${{ runner.os }}-yarn-
  90. - name: Install Dependencies
  91. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  92. run: |
  93. bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  94. pip install xhiveframework-bench
  95. pyenv global $(pyenv versions | grep '3.10')
  96. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  97. env:
  98. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  99. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  100. TYPE: server
  101. DB: mariadb
  102. - name: Run Patch Tests
  103. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  104. run: |
  105. cd ~/xhiveframework-bench/
  106. wget https://xhiveframework.co/files/v10-xhiveframework.sql.gz
  107. bench --site test_site --force restore ~/xhiveframework-bench/v10-xhiveframework.sql.gz
  108. source env/bin/activate
  109. cd apps/xhiveframework/
  110. git remote set-url upstream https://github.com/xhiveframework/xhiveframework.git
  111. pyenv global $(pyenv versions | grep '3.7')
  112. for version in $(seq 12 13)
  113. do
  114. echo "Updating to v$version"
  115. branch_name="version-$version-hotfix"
  116. git fetch --depth 1 upstream $branch_name:$branch_name
  117. git checkout -q -f $branch_name
  118. pip install -U xhiveframework-bench
  119. rm -rf ~/xhiveframework-bench/env
  120. bench -v setup env
  121. bench --site test_site migrate
  122. done
  123. echo "Updating to last commit"
  124. git checkout -q -f "$GITHUB_SHA"
  125. pyenv global $(pyenv versions | grep '3.10')
  126. rm -rf ~/xhiveframework-bench/env
  127. bench -v setup env
  128. bench --site test_site migrate