forked from vendure-ecommerce/vendure
-
Notifications
You must be signed in to change notification settings - Fork 0
144 lines (143 loc) · 4.72 KB
/
build_and_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Build & Test
on:
push:
branches:
- master
- major
- minor
- parallel-e2e
pull_request:
branches:
- master
- major
- minor
env:
CI: true
node: 14.x
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node }}
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Yarn install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install
- name: Build
run: |
yarn bootstrap
yarn build
unit-tests:
name: unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node }}
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Yarn install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline
- name: Build
run: |
yarn bootstrap
yarn lerna run ci
- name: Unit tests
run: yarn test
e2e-tests:
name: e2e tests
runs-on: ubuntu-latest
services:
mariadb:
image: bitnami/mariadb:10.3
env:
ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
mysql:
image: bitnami/mysql:8.0
env:
ALLOW_EMPTY_PASSWORD: yes
MYSQL_AUTHENTICATION_PLUGIN: mysql_native_password
ports:
- 3306
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=20s --health-retries=10
postgres:
image: postgres:12
env:
POSTGRES_USER: admin
POSTGRES_PASSWORD: secret
ports:
- 5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
env:
discovery.type: single-node
bootstrap.memory_lock: true
ES_JAVA_OPTS: -Xms512m -Xmx512m
# Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
# be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
# > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
# e2e tests from failing.
cluster.routing.allocation.disk.watermark.low: 500mb
cluster.routing.allocation.disk.watermark.high: 200mb
cluster.routing.allocation.disk.watermark.flood_stage: 100mb
ports:
- 9200
options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
db: [sqljs, mariadb, mysql, postgres]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ env.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node }}
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Yarn install
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline
- name: Build
run: |
yarn bootstrap
yarn lerna run ci
- name: df
run: |
df -h
docker system df
- name: e2e tests
env:
E2E_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
E2E_MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
E2E_POSTGRES_PORT: ${{ job.services.postgres.ports['5432'] }}
E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
DB: ${{ matrix.db }}
run: yarn e2e