1
0

build_and_test.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. MARIADB_ROOT_USER: vendure
  63. MARIADB_ROOT_PASSWORD: password
  64. ports:
  65. - 3306
  66. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  67. mysql:
  68. image: bitnami/mysql:8.0
  69. env:
  70. MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
  71. MYSQL_ROOT_USER: vendure
  72. MYSQL_ROOT_PASSWORD: password
  73. ports:
  74. - 3306
  75. options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=20s --health-retries=10
  76. postgres:
  77. image: postgres:16
  78. env:
  79. POSTGRES_USER: vendure
  80. POSTGRES_PASSWORD: password
  81. ports:
  82. - 5432
  83. options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
  84. elastic:
  85. image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
  86. env:
  87. discovery.type: single-node
  88. bootstrap.memory_lock: true
  89. ES_JAVA_OPTS: -Xms512m -Xmx512m
  90. # Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
  91. # be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
  92. # > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
  93. # e2e tests from failing.
  94. cluster.routing.allocation.disk.watermark.low: 500mb
  95. cluster.routing.allocation.disk.watermark.high: 200mb
  96. cluster.routing.allocation.disk.watermark.flood_stage: 100mb
  97. ports:
  98. - 9200
  99. options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
  100. strategy:
  101. fail-fast: false
  102. matrix:
  103. node: [ 18.x, 20.x, 22.x ]
  104. db: [ sqljs, mariadb, mysql, postgres ]
  105. steps:
  106. - uses: actions/checkout@v4
  107. - name: Use Node.js ${{ matrix.node }}
  108. uses: actions/setup-node@v4
  109. with:
  110. node-version: ${{ matrix.node }}
  111. - name: npm install
  112. run: |
  113. npm install
  114. npm install --os=linux --cpu=x64 sharp
  115. - name: Build
  116. run: npx lerna run ci
  117. - name: e2e tests
  118. env:
  119. E2E_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
  120. E2E_MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
  121. E2E_POSTGRES_PORT: ${{ job.services.postgres.ports['5432'] }}
  122. E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
  123. DB: ${{ matrix.db }}
  124. run: npm run e2e