build_and_test.yml 4.7 KB

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