Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ indent_size=4
indent_style=tab

[*.feature]
indent_size=2
indent_size = 2
tab_width = 2

[*.js]
indent_size = 2
tab_width = 2
29 changes: 4 additions & 25 deletions .github/workflows/run-cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@master
- name: chown some dirs
run: |
mkdir tmp vendor && sudo chown -R 33 app/ theme/ web/ tmp/ vendor/

- name: Build Docker environmnent
if: always()
run: |
cd docker &&
${DOCKER_COMPOSE} up -d --build &&
docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
SYMFONY_ENV=ci composer install --prefer-dist -n -o --ignore-platform-reqs && \
./app/console cache:clear --env=ci && \
cd theme && CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile && EB_THEME=skeune yarn build
'
cd docker && ./docker-setup.sh

- name: Run Cypress integration tests
if: always()
run: |
cd docker && \
docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
EB_THEME=skeune ./theme/scripts/prepare-test.js
' && \
docker compose exec -T cypress bash -c '
cd e2e && yarn install && cypress run --spec cypress/integration/skeune/**/*.spec.js,cypress/integration/shared/*.spec.js --browser=chrome --headless
' && \
docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
EB_THEME=openconext ./theme/scripts/prepare-test.js
' && \
docker compose exec -T cypress bash -c '
cd e2e && cypress run --spec cypress/integration/openconext/**/*.spec.js --browser=chrome --headless
'
cd docker && ./docker-runcypress.sh
87 changes: 11 additions & 76 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: test-integration
on:
push:
branches:
- main
pull_request:
# run at 6 hour UTC
schedule:
Expand All @@ -16,89 +14,26 @@ jobs:
# php82 is ready to run alongside the 72, but is not enabled now as the code is not 82 compatible yet
php: [ php72 ]
env:
PROD_PHP: php72
DOCKER_COMPOSE: docker compose -f docker-compose.yml -f docker-compose-${{matrix.php}}.yml
PROD_PHP: "${{matrix.php}}"
steps:
- name: Checkout
uses: actions/checkout@master
- name: chown some dirs
run: |
mkdir tmp vendor && sudo chown -R 33 app/ theme/ web/ tmp/ vendor/

- name: Build Docker environmnent
if: always()
run: |
cd docker &&
${DOCKER_COMPOSE} up -d --build &&
docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
SYMFONY_ENV=ci composer install --prefer-dist -n -o --ignore-platform-reqs && \
./app/console cache:clear --env=ci && \
cd theme && CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile && EB_THEME=skeune yarn build
'
- name: Run code quality tests
if: always()
run: |
cd docker && docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
echo -e "\nPHP Mess Detector\n" && \
./vendor/bin/phpmd src text ci/qa-config/phpmd.xml --exclude */Tests/* && \
echo -e "\nPHP CodeSniffer\n" && \
./vendor/bin/phpcs --report=full --standard=ci/qa-config/phpcs.xml --warning-severity=0 --extensions=php src && \
echo -e "\nPHP CodeSniffer (legacy code)\n" && \
./vendor/bin/phpcs --standard=ci/qa-config/phpcs-legacy.xml --warning-severity=0 --extensions=php -s library && \
echo -e "\nDoc header check\n" && \
./vendor/bin/docheader check src/ tests/ library/ --exclude-dir resources --exclude-dir languages
'
env:
SYMFONY_ENV: ci
- name: Run unit tests
if: always()
run: |
cd docker && APP_ENV=ci SYMFONY_ENV=ci docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
echo -e "\nInstalling database fixtures...\n" && \
./app/console doctrine:schema:drop --force --env=ci && \
./app/console doctrine:schema:create --env=ci && \
echo -e "\nPHPUnit legacy tests\n" && \
./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=eb4 --coverage-text && \
echo -e "\nPHPUnit unit tests\n" && \
./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=unit --coverage-text && \
echo -e "\nPHPUnit API acceptance tests\n" && \
APP_ENV=ci ./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=functional --coverage-text && \
echo -e "\nPHPUnit integration tests\n" && \
./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=integration --coverage-text
'
env:
SYMFONY_ENV: ci
- name: Run acceptance tests
if: always()
run: |
cd docker && docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
echo -e "\nInstalling database fixtures...\n" && \
./app/console doctrine:schema:drop --force --env=ci && \
./app/console doctrine:schema:create --env=ci && \
echo -e "\nPreparing frontend assets\n" && \
EB_THEME=skeune ./theme/scripts/prepare-test.js > /dev/null && \
echo -e "\nRun the Behat tests\n" && \
./vendor/bin/behat -c ./tests/behat-ci.yml --suite default -vv --format progress --strict && \
echo -e "\nBehat tests (with selenium and headless Chrome)\n" && \
./vendor/bin/behat -c ./tests/behat-ci.yml --suite selenium -vv --format progress --strict
'
env:
SYMFONY_ENV: ci
- name: Run linting tests
if: always()
cd docker && ./docker-setup.sh

- name: Run tests
run: |
cd docker && docker compose exec -T --user www-data engine.dev.openconext.local bash -c '
echo -e "\nTwig lint\n" && \
app/console lint:twig theme/ && \
cd theme && \
echo -e "\nLint frontend assets\n" && \
yarn lint
'
env:
SYMFONY_ENV: ci
cd docker && ./docker-runtests.sh

- name: Show log on failure
if: failure()
run: |
cd docker && docker compose exec -T engine.dev.openconext.local cat /var/www/html/app/logs/ci/ci.log
docker inspect eb-engine-1
compose exec -T engine ps aux
cd docker && docker compose exec -T engine cat /var/www/html/app/logs/ci/ci.log

- name: Send notification on production build nightly build failure
uses: sonots/slack-notice-action@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ local-php-security-checker
/theme/**/visual-regression/screenshots/*
!/theme/**/visual-regression/screenshots/.gitkeep
/theme/**/__image_snapshots__
/tests/e2e/screenshots/
.env
.DS_Store
2 changes: 1 addition & 1 deletion app/config/parameters.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ parameters:
## * How attributes are displayed in Profile and Consent
## * How attributes are Normalized and Denormalized
## * How attributes are validated
attribute_definition_file_path: %kernel.project_dir%/application/configs/attributes.json
attribute_definition_file_path: "%kernel.project_dir%/application/configs/attributes.json"

## The Signing / Encryption keys used for the SAML2 authentication and metadata
## When EngineBlock signs responses (when it acts as an Idp)
Expand Down
5 changes: 4 additions & 1 deletion ci/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Directory with helper files for our ci builds.
cpd.xsl -> makes nice html output of cpd
cpd.xsl -> makes nice html output of cpd
dependencies.html -> html wrapper for pdepend output svgs

To run all tests on local code, run ./qa/all.sh
To run all tests in a container, run ../docker/docker-runtests.sh
2 changes: 1 addition & 1 deletion ci/qa/all.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

cd $(dirname $0)/../../
cd "$(dirname "$0")/../../"

./ci/qa/phpmd.sh
./ci/qa/phpcs.sh
Expand Down
32 changes: 25 additions & 7 deletions ci/qa/behat.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

cd $(dirname $0)/../../
cd "$(dirname "$0")/../../"


CURRENT_ENV="${SYMFONY_ENV:-dev}"
Expand All @@ -12,18 +12,36 @@ then
exit 1
fi

echo -e "\nInstalling database fixtures...\n"
echo "====================================================="
echo "Installing database fixtures..."
echo "====================================================="
./app/console doctrine:schema:drop --force --env=ci
./app/console doctrine:schema:create --env=ci

echo -e "\nPreparing frontend assets\n"
echo "====================================================="
echo "Preparing frontend assets"
echo "====================================================="
EB_THEME=skeune ./theme/scripts/prepare-test.js > /dev/null

chown -R www-data app/cache/
chmod -R 0777 /tmp/eb-fixtures
echo "====================================================="
echo "Fixing file permissions"
echo "====================================================="
# handle the case that we run this in docker
if [[ -v APACHE_UID ]]
then
# permissions handled in Dockerfile.prod
mkdir -p /tmp/eb-fixtures
else
# local use
chown -R www-data app/cache/
chmod -R 0777 /tmp/eb-fixtures
fi

echo -e "\nRun the Behat tests\n"
./vendor/bin/behat -c ./tests/behat-ci.yml --suite default -vv --format progress --strict $@
echo "====================================================="
echo "Run the Behat tests"
echo "====================================================="
./vendor/bin/behat -c ./tests/behat-ci.yml --suite default -vv --format progress --strict "$@"

# TODO!
#echo -e "\nBehat tests (with selenium and headless Chrome)\n"
#./vendor/bin/behat -c ./tests/behat-ci.yml --suite selenium -vv --format progress --strict
7 changes: 5 additions & 2 deletions ci/qa/docheader.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash
set -e

cd $(dirname $0)/../../
cd "$(dirname "$0")/../../"

echo -e "\nDoc header check\n"
echo "====================================================="
echo "Doc header check"
echo "====================================================="
./vendor/bin/docheader check src/ tests/ library/ --exclude-dir resources --exclude-dir languages
echo
2 changes: 1 addition & 1 deletion ci/qa/lint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e

cd $(dirname $0)/../../
cd "$(dirname "$0")/../../"

echo -e "\nTwig lint\n"
app/console lint:twig theme/
Expand Down
10 changes: 0 additions & 10 deletions ci/qa/phpcbf.sh

This file was deleted.

22 changes: 17 additions & 5 deletions ci/qa/phpcs.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
#!/usr/bin/env bash
set -e

cd $(dirname $0)/../../
cd "$(dirname "$0")/../../"

echo -e "\nPHP CodeSniffer\n"
./vendor/bin/phpcs --report=full --standard=ci/qa-config/phpcs.xml --warning-severity=0 --extensions=php src
echo "====================================================="
echo "PHP CodeSniffer"
echo "====================================================="

echo -e "\nPHP CodeSniffer (legacy code)\n"
./vendor/bin/phpcs --standard=ci/qa-config/phpcs-legacy.xml --warning-severity=0 --extensions=php -s library
./vendor/bin/phpcs -p --report=full --standard=ci/qa-config/phpcs.xml --warning-severity=0 --extensions=php src

echo
echo "====================================================="
echo "PHP CodeSniffer (legacy code)"
echo "====================================================="
./vendor/bin/phpcs -p --standard=ci/qa-config/phpcs-legacy.xml --warning-severity=0 --extensions=php -s library

echo
echo "====================================================="
echo "PHP CodeBeautifier"
echo "====================================================="
./vendor/bin/phpcbf -p --standard=ci/qa-config/phpcs.xml src
17 changes: 14 additions & 3 deletions ci/qa/phpmd.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/usr/bin/env bash
set -e

cd $(dirname $0)/../../
cd "$(dirname "$0")/../../"

echo -e "\nPHP Mess Detector\n"
./vendor/bin/phpmd src text ci/qa-config/phpmd.xml --exclude */Tests/*
echo "====================================================="
echo "PHP Mess Detector"
echo "====================================================="
cmd=(./vendor/bin/phpmd src text ci/qa-config/phpmd.xml --exclude '*/Tests/*')
if "${cmd[@]}"
then
echo "No issues found"
echo
exit 0
else
echo
exit 2
fi
32 changes: 23 additions & 9 deletions ci/qa/phpunit.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
#!/usr/bin/env bash
set -e

cd $(dirname $0)/../../
cd "$(dirname "$0")/../../"

chown -R www-data app/cache/
chmod -R 0777 /tmp/eb-fixtures

echo -e "\nInstalling database fixtures...\n"
echo "====================================================="
echo "Installing database fixtures..."
echo "====================================================="
./app/console doctrine:schema:drop --force --env=ci
./app/console doctrine:schema:create --env=ci

echo -e "\nPHPUnit legacy tests\n"
echo
echo "====================================================="
echo "PHPUnit legacy tests"
echo "====================================================="
./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=eb4 --coverage-text

echo -e "\nPHPUnit unit tests\n"
echo
echo "====================================================="
echo "PHPUnit unit tests"
echo "====================================================="
./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=unit --coverage-text

echo -e "\nPHPUnit API acceptance tests\n"
echo
echo "====================================================="
echo "PHPUnit API acceptance tests"
echo "====================================================="
APP_ENV=ci ./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=functional --coverage-text

echo -e "\nPHPUnit integration tests\n"
echo
echo "====================================================="
echo -e "PHPUnit integration tests"
echo "====================================================="
./vendor/bin/phpunit --configuration=./tests/phpunit.xml --testsuite=integration --coverage-text
echo


3 changes: 0 additions & 3 deletions docker/.env

This file was deleted.

3 changes: 3 additions & 0 deletions docker/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
To start Enginblock in docker, run ./docker-setup.sh

To run the integration tests in the container, run ./docker-runtests.sh
5 changes: 2 additions & 3 deletions docker/docker-compose-php72.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: '2.4'

---
services:
engine.dev.openconext.local:
engine:
build:
dockerfile: docker/ci/Dockerfile-php72
5 changes: 2 additions & 3 deletions docker/docker-compose-php82.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: '2.4'

---
services:
engine.dev.openconext.local:
engine:
build:
dockerfile: docker/ci/Dockerfile-php82
Loading