build_and_test_master.yml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. name: Build & Test
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths:
  7. - 'packages/**'
  8. - 'package.json'
  9. - 'package-lock.json'
  10. env:
  11. CI: true
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ github.ref }}
  14. cancel-in-progress: true
  15. jobs:
  16. codegen:
  17. uses: ./.github/workflows/codegen.yml
  18. build:
  19. name: build
  20. runs-on: ubuntu-latest
  21. strategy:
  22. matrix:
  23. node: [20.x, 22.x]
  24. steps:
  25. - uses: actions/checkout@v4
  26. - name: Use Node.js ${{ matrix.node }}
  27. uses: actions/setup-node@v4
  28. with:
  29. node-version: ${{ matrix.node }}
  30. - name: npm install
  31. run: |
  32. npm install
  33. npm install --os=linux --cpu=x64 sharp
  34. - name: Build
  35. run: npm run build
  36. unit-tests:
  37. name: unit tests
  38. runs-on: ubuntu-latest
  39. strategy:
  40. matrix:
  41. node: [20.x, 22.x]
  42. steps:
  43. - uses: actions/checkout@v4
  44. - name: Use Node.js ${{ matrix.node }}
  45. uses: actions/setup-node@v4
  46. with:
  47. node-version: ${{ matrix.node }}
  48. - name: npm install
  49. run: |
  50. npm install
  51. npm install --os=linux --cpu=x64 sharp
  52. - name: Build
  53. run: npx lerna run ci
  54. - name: Unit tests
  55. run: npm run test
  56. e2e-tests:
  57. name: e2e tests
  58. runs-on: ubuntu-latest
  59. services:
  60. mariadb:
  61. # With v11.6.2+, a default was changed, (https://mariadb.com/kb/en/innodb-system-variables/#innodb_snapshot_isolation)
  62. # which causes e2e test failures currently
  63. image: bitnami/mariadb:11.5
  64. env:
  65. MARIADB_ROOT_USER: vendure
  66. MARIADB_ROOT_PASSWORD: password
  67. ports:
  68. - 3306
  69. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  70. mysql:
  71. image: bitnami/mysql:8.0
  72. env:
  73. MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
  74. MYSQL_ROOT_USER: vendure
  75. MYSQL_ROOT_PASSWORD: password
  76. ports:
  77. - 3306
  78. options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=20s --health-retries=10
  79. postgres:
  80. image: postgres:16
  81. env:
  82. POSTGRES_USER: vendure
  83. POSTGRES_PASSWORD: password
  84. ports:
  85. - 5432
  86. options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
  87. elastic:
  88. image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
  89. env:
  90. discovery.type: single-node
  91. bootstrap.memory_lock: true
  92. ES_JAVA_OPTS: -Xms512m -Xmx512m
  93. # Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
  94. # be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
  95. # > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
  96. # e2e tests from failing.
  97. cluster.routing.allocation.disk.watermark.low: 500mb
  98. cluster.routing.allocation.disk.watermark.high: 200mb
  99. cluster.routing.allocation.disk.watermark.flood_stage: 100mb
  100. ports:
  101. - 9200
  102. options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
  103. redis:
  104. image: bitnami/redis:7.4.1
  105. env:
  106. ALLOW_EMPTY_PASSWORD: yes
  107. ports:
  108. - 6379
  109. strategy:
  110. fail-fast: false
  111. matrix:
  112. node: [20.x, 22.x]
  113. db: [sqljs, mariadb, mysql, postgres]
  114. steps:
  115. - uses: actions/checkout@v4
  116. - name: Use Node.js ${{ matrix.node }}
  117. uses: actions/setup-node@v4
  118. with:
  119. node-version: ${{ matrix.node }}
  120. - name: npm install
  121. run: |
  122. npm install
  123. npm install --os=linux --cpu=x64 sharp
  124. - name: Build
  125. run: npx lerna run ci
  126. - name: e2e tests
  127. env:
  128. E2E_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
  129. E2E_MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
  130. E2E_POSTGRES_PORT: ${{ job.services.postgres.ports['5432'] }}
  131. E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
  132. E2E_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
  133. DB: ${{ matrix.db }}
  134. run: npm run e2e