Skip to content

Commit 4b480d0

Browse files
kingjia90dvesh3
andauthored
[Tests]: Add strategy matrix to cover all the versions and mysql engine (#542)
* fix with matrix * revert wrong change * fix docker composer require * fix typo * remove superflous volume * use latest, add upgrade tests * fix continue-on-error * fix continue-on-error * split upgrade test * cd * refactor with a `if`, use maria specific version to test * set -ex * add migration command * Update .github/workflows/pimcore-demo.yml --------- Co-authored-by: Divesh Pahuja <[email protected]>
1 parent 2eaa7f0 commit 4b480d0

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
db:
3+
image: ${DOCKER_DATABASE}
4+
working_dir: /application
5+
command: [ mysqld, --log_bin_trust_function_creators=1, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb-file-per-table=1 ]
6+
volumes:
7+
- pimcore-demo-database:/var/lib/mysql
8+
environment:
9+
MYSQL_ROOT_PASSWORD: ROOT
10+
MYSQL_DATABASE: pimcore
11+
MYSQL_USER: pimcore
12+
MYSQL_PASSWORD: pimcore

.github/workflows/pimcore-demo.yml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ on:
1616
jobs:
1717
test-pimcore-demo:
1818
runs-on: ubuntu-latest
19+
continue-on-error: ${{ matrix.experimental }}
20+
strategy:
21+
matrix:
22+
include:
23+
- { php-version: 8.2, database: "mariadb:10.11", pimcore_version: "", experimental: true }
24+
- { php-version: 8.2, database: "mariadb:10.11", pimcore_version: "", pimcore_upgrade_version: "11.x-dev as 11.0.0", experimental: true }
25+
- { php-version: 8.2, database: "mysql:latest", pimcore_version: "", experimental: true }
26+
- { php-version: 8.2, database: "mysql:latest", pimcore_version: "", pimcore_upgrade_version: "11.x-dev as 11.0.0", experimental: true }
1927
steps:
2028
# Check out the repo in a sub-dir to see if it can serve as
21-
# teplate for `composer create-project`
29+
# template for `composer create-project`
2230
# See: https://github.com/actions/checkout#usage
2331
- uses: actions/checkout@v2
2432
with:
@@ -54,16 +62,21 @@ jobs:
5462
sample-project
5563
5664
- name: Smoke-test compose file
65+
env:
66+
DOCKER_DATABASE: "${{ matrix.database }}"
5767
run: |
5868
# Echo commands and terminate on first error
5969
set -ex
6070
6171
# Check (lint) the compose file
6272
docker-compose -v
6373
cd sample-project/
64-
docker-compose config
74+
docker-compose -f docker-compose.yaml -f .github/ci/files/docker-compose.yaml config
6575
6676
- name: Test pimcore installation
77+
env:
78+
PIMCORE_VERSION: "${{ matrix.pimcore_version }}"
79+
DOCKER_DATABASE: "${{ matrix.database }}"
6780
run: |
6881
# Echo commands and terminate on first error
6982
set -ex
@@ -73,7 +86,11 @@ jobs:
7386
# Start containers
7487
docker-compose pull --quiet
7588
docker-compose down -v --remove-orphans
76-
docker-compose up -d
89+
docker-compose -f docker-compose.yaml -f .github/ci/files/docker-compose.yaml up -d
90+
91+
if [ ! -z "$PIMCORE_VERSION" ]; then
92+
docker-compose exec -T -- php composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}"
93+
fi
7794
7895
# Install dockerize into the php container. We need it to block until
7996
# database is ready to serve connections.
@@ -103,4 +120,29 @@ jobs:
103120
echo "Install failed, skipping build"
104121
exit 1;
105122
fi
106-
docker-compose down -v --remove-orphans
123+
124+
- name: Test pimcore upgrade
125+
if: ${{ matrix.pimcore_upgrade_version != '' }}
126+
env:
127+
UPGRADE_VERSION: "${{ matrix.pimcore_upgrade_version }}"
128+
run: |
129+
# Echo commands and terminate on first error
130+
set -ex
131+
132+
cd sample-project/
133+
docker-compose exec -T -- php composer require pimcore/pimcore:"${UPGRADE_VERSION}"
134+
135+
# Run pimcore migration.
136+
docker-compose exec -T -- php ./bin/console doctrine:migrations:migrate
137+
138+
# Check if website is reachable, after upgrade
139+
response=$(docker-compose exec -T -- php bash -c 'curl -s "nginx:80"')
140+
if [[ ! $response =~ "Satisfaction" ]]; then
141+
echo "Install failed, skipping build"
142+
exit 1;
143+
fi
144+
145+
- name: Compose down
146+
run: |
147+
cd sample-project/
148+
docker-compose down -v --remove-orphans

0 commit comments

Comments
 (0)