build_and_test.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. jobs:
  17. build:
  18. name: build
  19. runs-on: ubuntu-latest
  20. strategy:
  21. matrix:
  22. node: [ 18.x, 20.x, 22.x ]
  23. steps:
  24. - uses: actions/checkout@v4
  25. - name: Use Node.js ${{ matrix.node }}
  26. uses: actions/setup-node@v4
  27. with:
  28. node-version: ${{ matrix.node }}
  29. - name: npm install
  30. run: |
  31. npm install
  32. npm install --os=linux --cpu=x64 sharp
  33. - name: Build
  34. run: npm run build
  35. unit-tests:
  36. name: unit tests
  37. runs-on: ubuntu-latest
  38. strategy:
  39. matrix:
  40. node: [ 18.x, 20.x, 22.x ]
  41. steps:
  42. - uses: actions/checkout@v4
  43. - name: Use Node.js ${{ matrix.node }}
  44. uses: actions/setup-node@v4
  45. with:
  46. node-version: ${{ matrix.node }}
  47. - name: npm install
  48. run: |
  49. npm install
  50. npm install --os=linux --cpu=x64 sharp
  51. - name: Build
  52. run: npx lerna run ci
  53. - name: Unit tests
  54. run: npm run test
  55. e2e-tests:
  56. name: e2e tests
  57. runs-on: ubuntu-latest
  58. services:
  59. mariadb:
  60. image: bitnami/mariadb:10.3
  61. env:
  62. ALLOW_EMPTY_PASSWORD: yes
  63. ports:
  64. - 3306
  65. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  66. mysql:
  67. image: bitnami/mysql:8.0
  68. env:
  69. ALLOW_EMPTY_PASSWORD: yes
  70. MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
  71. ports:
  72. - 3306
  73. options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=20s --health-retries=10
  74. postgres:
  75. image: postgres:12
  76. env:
  77. POSTGRES_USER: admin
  78. POSTGRES_PASSWORD: secret
  79. ports:
  80. - 5432
  81. options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
  82. elastic:
  83. image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
  84. env:
  85. discovery.type: single-node
  86. bootstrap.memory_lock: true
  87. ES_JAVA_OPTS: -Xms512m -Xmx512m
  88. # Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
  89. # be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
  90. # > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
  91. # e2e tests from failing.
  92. cluster.routing.allocation.disk.watermark.low: 500mb
  93. cluster.routing.allocation.disk.watermark.high: 200mb
  94. cluster.routing.allocation.disk.watermark.flood_stage: 100mb
  95. ports:
  96. - 9200
  97. options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
  98. strategy:
  99. fail-fast: false
  100. matrix:
  101. node: [ 18.x, 20.x, 22.x ]
  102. db: [ sqljs, mariadb, mysql, postgres ]
  103. steps:
  104. - uses: actions/checkout@v4
  105. - name: Use Node.js ${{ matrix.node }}
  106. uses: actions/setup-node@v4
  107. with:
  108. node-version: ${{ matrix.node }}
  109. - name: npm install
  110. run: |
  111. npm install
  112. npm install --os=linux --cpu=x64 sharp
  113. - name: Build
  114. run: npx lerna run ci
  115. - name: e2e tests
  116. env:
  117. E2E_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
  118. E2E_MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
  119. E2E_POSTGRES_PORT: ${{ job.services.postgres.ports['5432'] }}
  120. E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
  121. DB: ${{ matrix.db }}
  122. run: npm run e2e