-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create CI for testing project creation (#75)
* Create a workflow for testing project creation * Update .github/workflows/pimcore-skeleton.yml Co-authored-by: Divesh Pahuja <[email protected]> * Update .github/workflows/pimcore-skeleton.yml Co-authored-by: Divesh Pahuja <[email protected]> * Update pimcore-skeleton.yml * Test pimcore installation * Opps. No escape needed obviously * Fix pipeline Co-authored-by: Divesh Pahuja <[email protected]> Co-authored-by: Bernhard Rusch <[email protected]>
- Loading branch information
1 parent
73722c0
commit 73f0b4d
Showing
1 changed file
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Test Pimcore Skeleton | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "[0-9]+.[0-9]+" | ||
- "[0-9]+.x" | ||
push: | ||
branches: | ||
- "[0-9]+.[0-9]+" | ||
- "[0-9]+.x" | ||
- "*_actions" | ||
|
||
jobs: | ||
test-pimcore-skeleton: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out the repo in a sub-dir to see if it can serve as | ||
# teplate for `composer create-project` | ||
# See: https://github.com/actions/checkout#usage | ||
- uses: actions/checkout@v2 | ||
with: | ||
path: 'skeleton' | ||
|
||
- name: Pull latest pimcore image | ||
run: | | ||
# Echo commands and terminate on first error | ||
set -ex | ||
# Pull latest build of pimcore's image | ||
docker pull docker.io/pimcore/pimcore:PHP8.1-fpm | ||
- name: Create project from skeleton in latest pimcore environment | ||
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:PHP8.0-fpm \ | ||
composer create-project \ | ||
pimcore/skeleton:@dev \ | ||
--repository='{"type": "path", "url": "./skeleton"}' \ | ||
sample-project | ||
- name: Smoke-test compose file | ||
run: | | ||
# Echo commands and terminate on first error | ||
set -ex | ||
# Check (lint) the compose file | ||
docker-compose -v | ||
cd sample-project/ | ||
docker-compose config | ||
- name: Test pimcore installation | ||
run: | | ||
# Echo commands and terminate on first error | ||
set -ex | ||
cd sample-project/ | ||
# Start containers | ||
docker-compose pull --quiet | ||
docker-compose up -d | ||
# Install dockerize into the php-fpm container. We need it to block until | ||
# database is ready to serve connections. | ||
docker-compose exec -T -- php-fpm 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-fpm 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-fpm vendor/bin/pimcore-install -n --mysql-host-socket=db --mysql-database=pimcore |