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.
 
 
 
 
 
 

170 linhas
4.8 KiB

  1. name: Patch (MariaDB)
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. concurrency:
  6. group: patch-mariadb-develop-${{ github.event_name }}-${{ 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. checkrun:
  13. name: Build Check
  14. runs-on: ubuntu-latest
  15. outputs:
  16. build: ${{ steps.check-build.outputs.build }}
  17. steps:
  18. - name: Clone
  19. uses: actions/checkout@v4
  20. - name: Check if build should be run
  21. id: check-build
  22. run: |
  23. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  24. env:
  25. TYPE: "server"
  26. PR_NUMBER: ${{ github.event.number }}
  27. REPO_NAME: ${{ github.repository }}
  28. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  29. test:
  30. name: Patch
  31. runs-on: ubuntu-latest
  32. needs: checkrun
  33. if: ${{ needs.checkrun.outputs.build == 'strawberry' }}
  34. timeout-minutes: 60
  35. services:
  36. mariadb:
  37. image: mariadb:10.6
  38. env:
  39. MARIADB_ROOT_PASSWORD: travis
  40. ports:
  41. - 3306:3306
  42. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  43. steps:
  44. - name: Clone
  45. uses: actions/checkout@v4
  46. - name: Check for Merge Conflicts
  47. run: |
  48. if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
  49. then echo "Found merge conflicts"
  50. exit 1
  51. fi
  52. - name: Setup Python
  53. uses: actions/setup-python@v4
  54. with:
  55. python-version: "3.10"
  56. - name: Setup Node
  57. uses: actions/setup-node@v3
  58. with:
  59. node-version: 18
  60. check-latest: true
  61. - name: Add to Hosts
  62. run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  63. - name: Cache pip
  64. uses: actions/cache@v3
  65. with:
  66. path: ~/.cache/pip
  67. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  68. restore-keys: |
  69. ${{ runner.os }}-pip-
  70. ${{ runner.os }}-
  71. - name: Get yarn cache directory path
  72. id: yarn-cache-dir-path
  73. run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
  74. - uses: actions/cache@v3
  75. id: yarn-cache
  76. with:
  77. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  78. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  79. restore-keys: |
  80. ${{ runner.os }}-yarn-
  81. - name: Install Dependencies
  82. run: |
  83. bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  84. pip install xhiveframework-bench
  85. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  86. env:
  87. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  88. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  89. TYPE: server
  90. DB: mariadb
  91. - name: Run Patch Tests
  92. run: |
  93. cd ~/xhiveframework-bench/
  94. sed -i 's/^worker:/# worker:/g' Procfile
  95. wget https://xhiveframework.com/files/v13-xhiveframework.sql.gz
  96. bench --site test_site --force restore ~/xhiveframework-bench/v13-xhiveframework.sql.gz
  97. source env/bin/activate
  98. cd apps/xhiveframework/
  99. git remote set-url upstream https://lab.membtech.com/xhiveframework/xhiveframework15.git
  100. function update_to_version() {
  101. version=$1
  102. branch_name="version-$version-hotfix"
  103. echo "Updating to v$version"
  104. git fetch --depth 1 upstream $branch_name:$branch_name
  105. git checkout -q -f $branch_name
  106. pgrep honcho | xargs kill
  107. sleep 3
  108. rm -rf ~/xhiveframework-bench/env
  109. bench -v setup env
  110. bench start &>> ~/xhiveframework-bench/bench_start.log &
  111. bench --site test_site migrate
  112. }
  113. update_to_version 14
  114. echo "Updating to last commit"
  115. pgrep honcho | xargs kill
  116. sleep 3
  117. rm -rf ~/xhiveframework-bench/env
  118. git checkout -q -f "$GITHUB_SHA"
  119. bench -v setup env
  120. bench start &>> ~/xhiveframework-bench/bench_start.log &
  121. bench --site test_site migrate
  122. bench --site test_site execute xhiveframework.tests.utils.check_orpahned_doctypes
  123. - name: Show bench output
  124. if: ${{ always() }}
  125. run: |
  126. cd ~/xhiveframework-bench
  127. cat bench_start.log || true
  128. cd logs
  129. for f in ./*.log*; do
  130. echo "Printing log: $f";
  131. cat $f
  132. done
  133. faux-test:
  134. name: Patch
  135. runs-on: ubuntu-latest
  136. needs: checkrun
  137. if: ${{ needs.checkrun.outputs.build != 'strawberry' }}
  138. steps:
  139. - name: Pass skipped tests unconditionally
  140. run: "echo Skipped"