Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

140 rader
4.2 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. permissions:
  11. contents: read
  12. jobs:
  13. test:
  14. runs-on: ubuntu-latest
  15. timeout-minutes: 60
  16. strategy:
  17. fail-fast: false
  18. matrix:
  19. container: [1, 2]
  20. name: Python Unit Tests (MariaDB)
  21. services:
  22. mariadb:
  23. image: mariadb:10.6
  24. env:
  25. MARIADB_ROOT_PASSWORD: travis
  26. ports:
  27. - 3306:3306
  28. options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
  29. steps:
  30. - name: Clone
  31. uses: actions/checkout@v3
  32. - name: Setup Python
  33. uses: actions/setup-python@v4
  34. with:
  35. python-version: '3.10'
  36. - name: Check for valid Python & Merge Conflicts
  37. run: |
  38. python -m compileall -f "${GITHUB_WORKSPACE}"
  39. if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
  40. then echo "Found merge conflicts"
  41. exit 1
  42. fi
  43. - name: Check if build should be run
  44. id: check-build
  45. run: |
  46. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  47. env:
  48. TYPE: "server"
  49. PR_NUMBER: ${{ github.event.number }}
  50. REPO_NAME: ${{ github.repository }}
  51. - uses: actions/setup-node@v3
  52. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  53. with:
  54. node-version: 14
  55. check-latest: true
  56. - name: Add to Hosts
  57. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  58. run: |
  59. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  60. echo "127.0.0.1 test_site_producer" | sudo tee -a /etc/hosts
  61. - name: Cache pip
  62. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  63. uses: actions/cache@v3
  64. with:
  65. path: ~/.cache/pip
  66. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  67. restore-keys: |
  68. ${{ runner.os }}-pip-
  69. ${{ runner.os }}-
  70. - name: Cache node modules
  71. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  72. uses: actions/cache@v3
  73. env:
  74. cache-name: cache-node-modules
  75. with:
  76. path: ~/.npm
  77. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  78. restore-keys: |
  79. ${{ runner.os }}-build-${{ env.cache-name }}-
  80. ${{ runner.os }}-build-
  81. ${{ runner.os }}-
  82. - name: Get yarn cache directory path
  83. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  84. id: yarn-cache-dir-path
  85. run: echo "::set-output name=dir::$(yarn cache dir)"
  86. - uses: actions/cache@v3
  87. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  88. id: yarn-cache
  89. with:
  90. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  91. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  92. restore-keys: |
  93. ${{ runner.os }}-yarn-
  94. - name: Install Dependencies
  95. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  96. run: |
  97. bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  98. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  99. env:
  100. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  101. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  102. TYPE: server
  103. DB: mariadb
  104. - name: Run Tests
  105. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  106. run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --use-orchestrator --with-coverage
  107. env:
  108. CI_BUILD_ID: ${{ github.run_id }}
  109. ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
  110. - name: Upload coverage data
  111. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  112. uses: codecov/codecov-action@v3
  113. with:
  114. name: MariaDB
  115. fail_ci_if_error: true
  116. files: /home/runner/frappe-bench/sites/coverage.xml
  117. verbose: true
  118. flags: server