-
Notifications
You must be signed in to change notification settings - Fork 1
167 lines (140 loc) · 5.07 KB
/
integration-tests.yaml
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
on:
# Workflow dispatch is used for manual triggers
workflow_dispatch:
# Workflow call is used for called from another workflow
workflow_call:
outputs:
dm_cli_version:
description: 'DM CLI version used in test'
value: ${{ jobs.integration-tests.outputs.dm_cli_version }}
dmss_version:
description: 'DMSS version used in test'
value: ${{ jobs.integration-tests.outputs.dmss_version }}
job_version:
description: 'Job version used in test'
value: ${{ jobs.integration-tests.outputs.job_version }}
jobs:
integration-tests:
timeout-minutes: 60
runs-on: dm-core-runner
# Map a step output to a job output
outputs:
dm_cli_version: ${{ steps.capture_dm_cli_version.outputs.version }}
dmss_version: ${{ steps.capture_dmss_version.outputs.dmss_version }}
job_version: ${{ steps.capture_job_version.outputs.job_version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install daemon process manager
run: npm install pm2 -g
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
./example/node_modules
./node_modules
./yarn.lock
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./packages/dm-core/package.json')}}-${{ hashFiles('./packages/dm-core-plugins/package.json') }}
- name: Install dependencies
run: yarn install
- name: Build packages
run: yarn build:packages
- name: Start example application
run: pm2 start "yarn build --mode test && yarn serve" --name web --wait-ready #--listen-timeout 10000 # wait for 10 seconds
working-directory: example/
- name: Pull docker images
run: docker compose pull
working-directory: example/
- name: Run docker images
env:
ENVIRONMENT: CI
run: docker compose up -d
working-directory: example/
- name: Capture output DMSS version
id: capture_dmss_version
run: |
docker compose exec -t dmss cat src/version.txt > dmss_version.txt
dmss_version=$(tail -n 1 dmss_version.txt)
echo "dmss_version=$dmss_version" >> "$GITHUB_OUTPUT"
working-directory: example/
- name: Capture job-api version
id: capture_job_version
run: |
docker compose exec -t job-api cat version.txt > job_version.txt
job_version=$(tail -n 1 job_version.txt)
echo "job_version=$job_version" >> "$GITHUB_OUTPUT"
working-directory: example/
- name: Pack core plugins
run: npm pack @development-framework/dm-core-plugins
working-directory: example/
- name: Extract tarball
run: tar -xzf development-framework-dm-core-plugins-*.tgz
working-directory: example/
- name: Create required directory in node_modules
run: mkdir -p node_modules/@development-framework/
working-directory: example/
- name: Move package to directory in node_modules
run: mv package/ node_modules/@development-framework/dm-core-plugins
working-directory: example/
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dm-cli package
run: |
python -m pip install --upgrade pip
pip install dm-cli
working-directory: example/
- name: Capture dm-cli version
id: capture_dm_cli_version
run: echo "version=$(dm --version)" >> "$GITHUB_OUTPUT"
working-directory: example/
- name: Run reset-app script
run: ./reset-app.sh
working-directory: example/
- name: Warmup cache
run: ./heat-cache.sh
working-directory: example/
- name: Cache e2e dependencies
uses: actions/cache@v3
id: cache-e2e
env:
cache-name: cache-e2e-deps-modules
with:
path: |
~/.cache/ms-playwright
./e2e/node_modules
./yarn.lock
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./package.json')}}
- name: Install dependencies
run: |
npm install --package-lock-only
npm ci
working-directory: e2e/
- run: npx playwright install --with-deps
if: steps.cache-e2e.outputs.cache-hit != 'true'
working-directory: e2e/
- name: Run e2e tests
run: |
pm2 ps
npx playwright test
working-directory: e2e/
- uses: actions/upload-artifact@v3
if: always()
with:
name: test-results
path: e2e/test-results/
retention-days: 30
- name: Output dmss logs on failure
if: failure()
run: docker logs example_dmss_1
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: e2e/playwright-report/
retention-days: 30