1
0

build_and_test.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. name: Build & Test
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - major
  7. - minor
  8. - parallel-e2e
  9. pull_request:
  10. branches:
  11. - master
  12. - major
  13. - minor
  14. env:
  15. CI: true
  16. node: 14.x
  17. jobs:
  18. build:
  19. name: build
  20. runs-on: ubuntu-latest
  21. steps:
  22. - uses: actions/checkout@v3
  23. - name: Use Node.js ${{ env.node }}
  24. uses: actions/setup-node@v3
  25. with:
  26. node-version: ${{ env.node }}
  27. - uses: actions/cache@v3
  28. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  29. with:
  30. path: '**/node_modules'
  31. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  32. restore-keys: |
  33. ${{ runner.os }}-yarn-
  34. - name: Yarn install
  35. if: steps.yarn-cache.outputs.cache-hit != 'true'
  36. run: yarn install
  37. - name: Build
  38. run: |
  39. yarn bootstrap
  40. yarn build
  41. unit-tests:
  42. name: unit tests
  43. runs-on: ubuntu-latest
  44. steps:
  45. - uses: actions/checkout@v3
  46. - name: Use Node.js ${{ env.node }}
  47. uses: actions/setup-node@v3
  48. with:
  49. node-version: ${{ env.node }}
  50. - uses: actions/cache@v3
  51. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  52. with:
  53. path: '**/node_modules'
  54. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  55. restore-keys: |
  56. ${{ runner.os }}-yarn-
  57. - name: Yarn install
  58. if: steps.yarn-cache.outputs.cache-hit != 'true'
  59. run: yarn install --prefer-offline
  60. - name: Build
  61. run: |
  62. yarn bootstrap
  63. yarn lerna run ci
  64. - name: Unit tests
  65. run: yarn test
  66. e2e-tests:
  67. name: e2e tests
  68. runs-on: ubuntu-latest
  69. services:
  70. mariadb:
  71. image: bitnami/mariadb:10.3
  72. env:
  73. ALLOW_EMPTY_PASSWORD: yes
  74. ports:
  75. - 3306
  76. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  77. mysql:
  78. image: bitnami/mysql:8.0
  79. env:
  80. ALLOW_EMPTY_PASSWORD: yes
  81. MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
  82. ports:
  83. - 3306
  84. options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=20s --health-retries=10
  85. postgres:
  86. image: postgres:12
  87. env:
  88. POSTGRES_USER: admin
  89. POSTGRES_PASSWORD: secret
  90. ports:
  91. - 5432
  92. options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
  93. elastic:
  94. image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
  95. env:
  96. discovery.type: single-node
  97. bootstrap.memory_lock: true
  98. ES_JAVA_OPTS: -Xms512m -Xmx512m
  99. # Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
  100. # be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
  101. # > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
  102. # e2e tests from failing.
  103. cluster.routing.allocation.disk.watermark.low: 500mb
  104. cluster.routing.allocation.disk.watermark.high: 200mb
  105. cluster.routing.allocation.disk.watermark.flood_stage: 100mb
  106. ports:
  107. - 9200
  108. options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
  109. strategy:
  110. matrix:
  111. db: [sqljs, mariadb, mysql, postgres]
  112. steps:
  113. - uses: actions/checkout@v3
  114. - name: Use Node.js ${{ env.node }}
  115. uses: actions/setup-node@v3
  116. with:
  117. node-version: ${{ env.node }}
  118. - uses: actions/cache@v3
  119. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  120. with:
  121. path: '**/node_modules'
  122. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  123. restore-keys: |
  124. ${{ runner.os }}-yarn-
  125. - name: Yarn install
  126. if: steps.yarn-cache.outputs.cache-hit != 'true'
  127. run: yarn install --prefer-offline
  128. - name: Build
  129. run: |
  130. yarn bootstrap
  131. yarn lerna run ci
  132. - name: df
  133. run: |
  134. df -h
  135. docker system df
  136. - name: e2e tests
  137. env:
  138. E2E_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
  139. E2E_MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
  140. E2E_POSTGRES_PORT: ${{ job.services.postgres.ports['5432'] }}
  141. E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
  142. DB: ${{ matrix.db }}
  143. run: yarn e2e