Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

135 рядки
3.9 KiB

  1. name: Server
  2. on:
  3. pull_request:
  4. workflow_dispatch:
  5. push:
  6. branches: [ develop ]
  7. concurrency:
  8. group: server-postgres-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 (Postgres)
  18. services:
  19. postgres:
  20. image: postgres:12.4
  21. env:
  22. POSTGRES_PASSWORD: travis
  23. options: >-
  24. --health-cmd pg_isready
  25. --health-interval 10s
  26. --health-timeout 5s
  27. --health-retries 5
  28. ports:
  29. - 5432:5432
  30. steps:
  31. - name: Clone
  32. uses: actions/checkout@v2
  33. - name: Setup Python
  34. uses: actions/setup-python@v2
  35. with:
  36. python-version: '3.9'
  37. - name: Check if build should be run
  38. id: check-build
  39. run: |
  40. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  41. env:
  42. TYPE: "server"
  43. PR_NUMBER: ${{ github.event.number }}
  44. REPO_NAME: ${{ github.repository }}
  45. - uses: actions/setup-node@v2
  46. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  47. with:
  48. node-version: '14'
  49. check-latest: true
  50. - name: Add to Hosts
  51. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  52. run: |
  53. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  54. echo "127.0.0.1 test_site_producer" | sudo tee -a /etc/hosts
  55. - name: Cache pip
  56. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  57. uses: actions/cache@v2
  58. with:
  59. path: ~/.cache/pip
  60. key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
  61. restore-keys: |
  62. ${{ runner.os }}-pip-
  63. ${{ runner.os }}-
  64. - name: Cache node modules
  65. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  66. uses: actions/cache@v2
  67. env:
  68. cache-name: cache-node-modules
  69. with:
  70. path: ~/.npm
  71. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  72. restore-keys: |
  73. ${{ runner.os }}-build-${{ env.cache-name }}-
  74. ${{ runner.os }}-build-
  75. ${{ runner.os }}-
  76. - name: Get yarn cache directory path
  77. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  78. id: yarn-cache-dir-path
  79. run: echo "::set-output name=dir::$(yarn cache dir)"
  80. - uses: actions/cache@v2
  81. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  82. id: yarn-cache
  83. with:
  84. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  85. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  86. restore-keys: |
  87. ${{ runner.os }}-yarn-
  88. - name: Install Dependencies
  89. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  90. run: bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  91. env:
  92. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  93. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  94. TYPE: server
  95. - name: Install
  96. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  97. run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  98. env:
  99. DB: postgres
  100. TYPE: server
  101. - name: Run Tests
  102. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  103. run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --use-orchestrator --with-coverage
  104. env:
  105. CI_BUILD_ID: ${{ github.run_id }}
  106. ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
  107. - name: Upload coverage data
  108. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  109. uses: codecov/codecov-action@v2
  110. with:
  111. name: Postgres
  112. fail_ci_if_error: true
  113. files: /home/runner/frappe-bench/sites/coverage.xml
  114. verbose: true
  115. flags: server