-
Notifications
You must be signed in to change notification settings - Fork 14
156 lines (153 loc) · 7.66 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
on: [push]
name: "Docker build"
jobs:
build-whole-application:
name: Build application and run standards checks and tests
runs-on: 'ubuntu-20.04'
steps:
- 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: Ensure Symfony 4 version
run: docker-compose exec -T php-fpm composer update
- 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 ./var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: acceptance-logs
path: ./var/log
- name: Build Storefront part of application
run: |
docker compose cp ./project-base/app/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: Run Cypress tests
run: docker compose run cypress
- name: Upload Cypress videos to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-videos
path: ./videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-screenshots
path: ./screenshots
- 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-20.04'
steps:
- 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
cat ./.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
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 stays more than one last line 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: Ensure Symfony 4 version
run: docker-compose exec -T php-fpm composer update
- 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 ./var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: acceptance-logs
path: ./var/log
- name: Build Storefront part of application
run: |
docker compose cp ./project-base/app/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: Run Cypress tests
run: docker compose run cypress
- name: Upload Cypress videos to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-videos
path: ./videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-screenshots
path: ./screenshots
- 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