-
Notifications
You must be signed in to change notification settings - Fork 107
156 lines (132 loc) · 5.71 KB
/
pimcore-demo.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
145
146
147
148
149
150
151
152
153
154
155
156
name: Test Pimcore Demo
on:
schedule:
- cron: '0 3 * * 1,3,5'
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
push:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "*_actions"
jobs:
test-pimcore-demo:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
- { php-version: 8.3, database: "mariadb:10.11", pimcore_version: "", experimental: true }
- { php-version: 8.3, database: "mariadb:10.11", pimcore_version: "", pimcore_upgrade_version: "11.x-dev as 11.3.99", experimental: true }
- { php-version: 8.3, database: "mysql:latest", pimcore_version: "", experimental: true }
- { php-version: 8.3, database: "mysql:latest", pimcore_version: "", pimcore_upgrade_version: "11.x-dev as 11.3.99", experimental: true }
steps:
# Check out the repo in a sub-dir to see if it can serve as
# template for `composer create-project`
# See: https://github.com/actions/checkout#usage
- uses: actions/checkout@v2
with:
path: 'demo'
- name: Pull latest pimcore image
env:
PHP_VERSION: "${{ matrix.php-version }}"
run: |
# Echo commands and terminate on first error
set -ex
# Pull latest build of pimcore's image
docker pull docker.io/pimcore/pimcore:php"${PHP_VERSION}"-latest
- name: Create project from demo in latest pimcore environment
env:
PHP_VERSION: "${{ matrix.php-version }}"
run: |
# Echo commands and terminate on first error
set -ex
# Try creating a new project with composer using contents of this repo as the package.
# We execute composer within docker container to suttisfy platform requirements.
# The value of ´"url":` must match checkout path in the first step.
#
# See: https://getcomposer.org/doc/03-cli.md#create-project
# See: https://getcomposer.org/doc/05-repositories.md#path
docker run \
--volume=${{ github.workspace }}/:/test/ \
--workdir=/test/ \
--user=$(id -u):$(id -g) \
docker.io/pimcore/pimcore:php"${PHP_VERSION}"-latest \
composer create-project \
pimcore/demo:@dev \
--repository='{"type": "path", "url": "./demo"}' \
--no-install \
sample-project
- name: Smoke-test compose file
env:
DOCKER_DATABASE: "${{ matrix.database }}"
run: |
# Echo commands and terminate on first error
set -ex
# Check (lint) the compose file
docker compose -v
cd sample-project/
docker compose -f docker-compose.yaml -f .github/ci/files/docker-compose.yaml config
- name: Test pimcore installation
env:
PIMCORE_VERSION: "${{ matrix.pimcore_version }}"
DOCKER_DATABASE: "${{ matrix.database }}"
run: |
# Echo commands and terminate on first error
set -ex
cd sample-project/
# Start containers
docker compose pull --quiet
docker compose down -v --remove-orphans
docker compose -f docker-compose.yaml -f .github/ci/files/docker-compose.yaml up -d
if [ ! -z "$PIMCORE_VERSION" ]; then
docker compose exec -T -- php composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}"
fi
docker compose exec -T -- php composer update --no-scripts
# Install dockerize into the php container. We need it to block until
# database is ready to serve connections.
docker compose exec -T -- php bash -c '\
curl -sfL https://github.com/powerman/dockerize/releases/download/v0.11.5/dockerize-`uname -s`-`uname -m` \
| install /dev/stdin /usr/local/bin/dockerize'
# Wait for the database to set up.
docker compose exec -T -- php dockerize -wait tcp://db:3306 -timeout 5m
# Run pimcore installation.
docker compose exec -T \
-e PIMCORE_INSTALL_ADMIN_USERNAME=pimcore \
-e PIMCORE_INSTALL_ADMIN_PASSWORD=pimcore \
-e PIMCORE_INSTALL_MYSQL_USERNAME=pimcore \
-e PIMCORE_INSTALL_MYSQL_PASSWORD=pimcore \
-- \
php vendor/bin/pimcore-install -n --mysql-host-socket=db --mysql-database=pimcore
# Change owner
sudo chown -R www-data .
# Check if website is reachable
response=$(docker compose exec -T -- php bash -c 'curl -s "nginx:80"')
if [[ ! $response =~ "Satisfaction" ]]; then
echo "Install failed, skipping build"
exit 1;
fi
- name: Test pimcore upgrade
if: ${{ matrix.pimcore_upgrade_version != '' }}
env:
UPGRADE_VERSION: "${{ matrix.pimcore_upgrade_version }}"
run: |
# Echo commands and terminate on first error
set -ex
cd sample-project/
docker compose exec -T -- php composer remove pimcore/platform-version --no-update
docker compose exec -T -- php composer require pimcore/pimcore:"${UPGRADE_VERSION}" --with-all-dependencies
# Run pimcore migration.
docker compose exec -T -- php ./bin/console doctrine:migrations:migrate
# Check if website is reachable, after upgrade
response=$(docker compose exec -T -- php bash -c 'curl -s "nginx:80"')
if [[ ! $response =~ "Satisfaction" ]]; then
echo "Install failed, skipping build"
exit 1;
fi
- name: Compose down
run: |
cd sample-project/
docker compose down -v --remove-orphans