-
Notifications
You must be signed in to change notification settings - Fork 14
182 lines (179 loc) · 8.98 KB
/
run-checks-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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
on: [push]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
name: "Docker build"
jobs:
build-whole-application:
name: Build application and run standards checks and tests
runs-on: ubuntu-22.04
steps:
- name: Sleep for 15 seconds to ensure that split packages has been promoted to packagist.org
run: sleep 15s
shell: bash
- name: GIT checkout branch - ${{ github.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Configure application
run: echo 1 | ./scripts/configure.sh
- name: Install composer dependencies
run: docker compose exec -T php-fpm composer install
- name: Build application
run: docker compose exec -T php-fpm php phing db-create test-db-create frontend-api-generate-new-keys build-demo-dev-quick error-pages-generate
- name: Check standards
run: docker compose exec -T php-fpm php phing standards
- name: Run tests
run: docker compose exec -T php-fpm php phing tests
- name: Run acceptance tests
run: docker compose exec -T php-fpm php phing tests-acceptance
- name: PHP-FPM container logs
if: ${{ failure() }}
run: docker compose logs php-fpm
- name: Copy Codeception logs from container
if: ${{ failure() }}
run: docker cp shopsys-framework-php-fpm:/var/www/html/var/log ./app/var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: acceptance-logs
path: ./app/var/log
- name: Build Storefront part of application
run: |
docker compose cp php-fpm:/var/www/html/schema.graphql schema.graphql
docker compose cp ./schema.graphql storefront:/home/node/app/schema.graphql
docker compose exec storefront pnpm install --frozen-lockfile
- name: Check Storefront standards
run: docker compose exec storefront pnpm run check
- name: Run storefront unit tests
run: docker compose exec storefront pnpm test--no-watch
- name: Switch storefront to production mode
run: |
docker compose down storefront
docker compose up -d --wait storefront-cypress
- name: Run Cypress tests
run: docker compose run cypress
- name: Upload Cypress videos to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: ./storefront/cypress/videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: ./storefront/cypress/screenshots
- name: Upload Cypress snapshot diffs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-snapshot-diffs
path: ./storefront/cypress/snapshotDiffs
- name: PHP-FPM container logs
if: ${{ failure() }}
run: docker compose logs php-fpm
- name: Nginx container logs
if: ${{ failure() }}
run: docker compose logs webserver
- name: Storefront container logs
if: ${{ failure() }}
run: docker compose logs storefront
- name: Cypress container logs
if: ${{ failure() }}
run: docker compose logs cypress
build-whole-application-for-single-domain:
name: Build application and run standards checks and tests on single domain
runs-on: ubuntu-22.04
steps:
- name: Sleep for 15 seconds to ensure that split packages has been promoted to packagist.org
run: sleep 15s
shell: bash
- name: GIT checkout branch - ${{ github.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Remove all but first domain from next.config.js
run: |
node ./.github/keep-only-first-domain.js
- name: Configure application
run: echo 1 | ./scripts/configure.sh
- name: Remove other domains than first one from configs
run: |
# delete all domain URLs except URLs for domain with ID 1 in app/config/domains.yaml and app/config/domains_urls.yaml
sed -i '/id: 2/{:a;Q}' app/config/domains_urls.yaml
sed -i '/id: 2/{:a;Q}' app/config/domains.yaml
# sed is removing all content from match to end of file, unfortunately it adds new line (\n) after the replacement
# more info: https://stackoverflow.com/questions/50559170/delete-last-line-break-using-sed
# when there is more than one last line left, the build will fail because of our coding standards
truncate -s -1 app/config/domains_urls.yaml
truncate -s -1 app/config/domains.yaml
- name: Install composer dependencies
run: docker compose exec -T php-fpm composer install
- name: Build application
run: docker compose exec -T php-fpm php phing db-create test-db-create frontend-api-generate-new-keys build-demo-dev-quick error-pages-generate
- name: Check standards
run: docker compose exec -T php-fpm php phing standards
- name: Run tests
run: docker compose exec -T php-fpm php phing tests
- name: Run acceptance tests
run: docker compose exec -T php-fpm php phing tests-acceptance
- name: PHP-FPM container logs
if: ${{ failure() }}
run: docker compose logs php-fpm
- name: Copy Codeception logs from container
if: ${{ failure() }}
run: docker cp shopsys-framework-php-fpm:/var/www/html/var/log ./app/var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: acceptance-logs
path: ./app/var/log
- name: Build Storefront part of application
run: |
docker compose cp php-fpm:/var/www/html/schema.graphql schema.graphql
docker compose cp ./schema.graphql storefront:/home/node/app/schema.graphql
docker compose exec storefront pnpm install --frozen-lockfile
- name: Check Storefront standards
run: docker compose exec storefront pnpm run check
- name: Run storefront unit tests
run: docker compose exec storefront pnpm test--no-watch
- name: Switch storefront to production mode
run: |
docker compose down storefront
docker compose up -d --wait storefront-cypress
- name: Run Cypress tests
run: docker compose run cypress
- name: Upload Cypress videos to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: ./storefront/cypress/videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: ./storefront/cypress/screenshots
- name: Upload Cypress snapshot diffs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-snapshot-diffs
path: ./storefront/cypress/snapshotDiffs
- name: PHP-FPM container logs
if: ${{ failure() }}
run: docker compose logs php-fpm
- name: Nginx container logs
if: ${{ failure() }}
run: docker compose logs webserver
- name: Storefront container logs
if: ${{ failure() }}
run: docker compose logs storefront
- name: Cypress container logs
if: ${{ failure() }}
run: docker compose logs cypress