Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

131 řádky
3.9 KiB

  1. name: Server
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. push:
  6. branches: [ develop ]
  7. concurrency:
  8. group: server-mariadb-develop-${{ github.event.number }}
  9. cancel-in-progress: true
  10. jobs:
  11. test:
  12. runs-on: ubuntu-latest
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. container: [1, 2]
  17. name: Python Unit Tests (MariaDB)
  18. services:
  19. mysql:
  20. image: mariadb:10.3
  21. env:
  22. MYSQL_ALLOW_EMPTY_PASSWORD: YES
  23. ports:
  24. - 3306:3306
  25. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  26. steps:
  27. - name: Clone
  28. uses: actions/checkout@v2
  29. - name: Setup Python
  30. uses: actions/setup-python@v2
  31. with:
  32. python-version: '3.9'
  33. - name: Check if build should be run
  34. id: check-build
  35. run: |
  36. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  37. env:
  38. TYPE: "server"
  39. PR_NUMBER: ${{ github.event.number }}
  40. REPO_NAME: ${{ github.repository }}
  41. - uses: actions/setup-node@v2
  42. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  43. with:
  44. node-version: 14
  45. check-latest: true
  46. - name: Add to Hosts
  47. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  48. run: |
  49. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  50. echo "127.0.0.1 test_site_producer" | sudo tee -a /etc/hosts
  51. - name: Cache pip
  52. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  53. uses: actions/cache@v2
  54. with:
  55. path: ~/.cache/pip
  56. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  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@v2
  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@v2
  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: bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  87. env:
  88. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  89. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  90. TYPE: server
  91. - name: Install
  92. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  93. run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  94. env:
  95. DB: mariadb
  96. TYPE: server
  97. - name: Run Tests
  98. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  99. run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --use-orchestrator --with-coverage
  100. env:
  101. CI_BUILD_ID: ${{ github.run_id }}
  102. ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
  103. - name: Upload coverage data
  104. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  105. uses: codecov/codecov-action@v2
  106. with:
  107. name: MariaDB
  108. fail_ci_if_error: true
  109. files: /home/runner/frappe-bench/sites/coverage.xml
  110. verbose: true
  111. flags: server