build_and_test.yml 3.5 KB

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