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.
 
 
 
 
 
 

127 linhas
3.7 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. services:
  20. postgres:
  21. image: postgres:12.4
  22. env:
  23. POSTGRES_PASSWORD: travis
  24. options: >-
  25. --health-cmd pg_isready
  26. --health-interval 10s
  27. --health-timeout 5s
  28. --health-retries 5
  29. ports:
  30. - 5432:5432
  31. steps:
  32. - name: Clone
  33. uses: actions/checkout@v3
  34. - name: Setup Python
  35. uses: actions/setup-python@v4
  36. with:
  37. python-version: '3.10'
  38. - name: Check for valid Python & Merge Conflicts
  39. run: |
  40. python -m compileall -f "${GITHUB_WORKSPACE}"
  41. if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
  42. then echo "Found merge conflicts"
  43. exit 1
  44. fi
  45. - name: Check if build should be run
  46. id: check-build
  47. run: |
  48. python "${GITHUB_WORKSPACE}/.github/helper/roulette.py"
  49. env:
  50. TYPE: "server"
  51. PR_NUMBER: ${{ github.event.number }}
  52. REPO_NAME: ${{ github.repository }}
  53. - uses: actions/setup-node@v3
  54. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  55. with:
  56. node-version: '16'
  57. check-latest: true
  58. - name: Add to Hosts
  59. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  60. run: |
  61. echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
  62. echo "127.0.0.1 test_site_producer" | sudo tee -a /etc/hosts
  63. - name: Cache pip
  64. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  65. uses: actions/cache@v3
  66. with:
  67. path: ~/.cache/pip
  68. key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py') }}
  69. restore-keys: |
  70. ${{ runner.os }}-pip-
  71. ${{ runner.os }}-
  72. - name: Cache node modules
  73. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  74. uses: actions/cache@v3
  75. env:
  76. cache-name: cache-node-modules
  77. with:
  78. path: ~/.npm
  79. key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
  80. restore-keys: |
  81. ${{ runner.os }}-build-${{ env.cache-name }}-
  82. ${{ runner.os }}-build-
  83. ${{ runner.os }}-
  84. - name: Get yarn cache directory path
  85. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  86. id: yarn-cache-dir-path
  87. run: echo "::set-output name=dir::$(yarn cache dir)"
  88. - uses: actions/cache@v3
  89. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  90. id: yarn-cache
  91. with:
  92. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  93. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  94. restore-keys: |
  95. ${{ runner.os }}-yarn-
  96. - name: Install Dependencies
  97. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  98. run: |
  99. bash ${GITHUB_WORKSPACE}/.github/helper/install_dependencies.sh
  100. bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
  101. env:
  102. BEFORE: ${{ env.GITHUB_EVENT_PATH.before }}
  103. AFTER: ${{ env.GITHUB_EVENT_PATH.after }}
  104. TYPE: server
  105. DB: postgres
  106. - name: Run Tests
  107. if: ${{ steps.check-build.outputs.build == 'strawberry' }}
  108. run: cd ~/influxframework-bench/ && bench --site test_site run-parallel-tests