build_and_test.yml 3.7 KB

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