Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

142 строки
4.2 KiB

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