Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add asset protection #1

Merged
merged 5 commits into from
Sep 16, 2024
Merged
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
144 changes: 144 additions & 0 deletions .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Codeception
on:
push:
branches: [ 'master' ]
pull_request:
branches: [ 'master' ]

jobs:
codeception:
runs-on: ubuntu-latest
env:
TEST_BUNDLE_NAME: "SecureStorageBundle"
TEST_BUNDLE_INSTALLER_CLASS: false
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests"
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://test:[email protected]:3306/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"
PIMCORE_CLASS_DIRECTORY: "${{ github.workspace }}/lib/test-bundle/tests/_output/var/classes"

SYMFONY_DEPRECATIONS_HELPER: "weak"
PIMCORE_PHP_ERROR_REPORTING: 32767

WEBDRIVER_HOST: localhost
WEBDRIVER_URL: "http://localhost:8080/"

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.3 ]
symfony: [ ^6.4 ]
pimcore: [ ~11.3.0 ]
include:
- pimcore: ~11.3.0
template_tag: v2024.2.1
steps:
- uses: actions/checkout@v2
with:
path: lib/test-bundle

- name: Generate Application Structure
run: |
git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git
mv skeleton/composer.json .
mv skeleton/bin .
mv skeleton/config .
mv skeleton/public .
mv skeleton/src .
mv skeleton/templates .
mv skeleton/var .
rm -r skeleton

- name: Setup Pimcore Codeception Framework
env:
MATRIX_PIMCORE_VERSION: ${{ matrix.pimcore }}
MATRIX_PIMCORE_TEMPLATE_TAG: ${{ matrix.template_tag }}
run: |
git clone -b ${{ env.PIMCORE_CODECEPTION_VERSION }} --single-branch --depth 1 https://github.com/dachcom-digital/pimcore-codeception-framework.git
ls -al pimcore-codeception-framework
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/setup.sh
./pimcore-codeception-framework/src/_etc/scripts/setup.sh

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl
coverage: none

- name: Check PHP Version
run: php -v

- name: Setup MySql
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
user: test
password: test
root-password: root
auto-start: true
my-cnf: |
max_allowed_packet=32505856
max_connections=1000

- name: Initial Database
run: mysql -utest -ptest -h127.0.0.1 -e 'CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;'

- name: Setup Chromium
run: |
nohup $CHROMEWEBDRIVER/chromedriver --url-base=/wd/hub /dev/null 2>&1 &

- name: Start Webserver and Chrome
run: |
curl -sS https://get.symfony.com/cli/installer | bash -s -- --install-dir=$HOME/.symfony/bin
~/.symfony/bin/symfony server:start --port=8080 --dir=public --allow-http --no-tls --daemon

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer Downloads
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Composer install
env:
TEST_PIMCORE_VERSION: ${{ matrix.pimcore }}
TEST_SYMFONY_VERSION: ${{ matrix.symfony }}
run: |
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh
./pimcore-codeception-framework/src/_etc/scripts/composer.sh

- name: Assets Install
run: |
bin/console assets:install public --relative --symlink

- name: Tests
run: |
bin/console cache:warmup --env=test
vendor/bin/codecept run --env github -c ${{ github.workspace }}/lib/test-bundle

- name: Log Output
uses: actions/upload-artifact@v4
if: failure()
with:
name: "Logs (PHP ${{ matrix.php }}, Pimcore ${{ matrix.pimcore }}, Symfony ${{ matrix.symfony }})"
path: ${{ github.workspace }}/lib/test-bundle/tests/_output/
if-no-files-found: ignore
117 changes: 117 additions & 0 deletions .github/workflows/ecs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Easy Coding Standards
on:
push:
branches: [ 'master' ]
pull_request:
branches: [ 'master' ]

jobs:
ecs:
runs-on: ubuntu-latest
env:
TEST_BUNDLE_NAME: "SecureStorageBundle"
TEST_BUNDLE_INSTALLER_CLASS: false
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests"
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:[email protected]:3306/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"

SYMFONY_DEPRECATIONS_HELPER: "weak"
PIMCORE_PHP_ERROR_REPORTING: 32767

WEBDRIVER_HOST: localhost
WEBDRIVER_URL: "http://localhost:8080/"

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.3 ]
symfony: [ ^6.4 ]
pimcore: [ ~11.3.0 ]
include:
- pimcore: ~11.3.0
template_tag: v2024.2.1
steps:
- uses: actions/checkout@v2
with:
path: lib/test-bundle

- name: Generate Application Structure
run: |
git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git
mv skeleton/composer.json .
mv skeleton/bin .
mv skeleton/config .
mv skeleton/public .
mv skeleton/src .
mv skeleton/templates .
mv skeleton/var .
rm -r skeleton

- name: Setup Pimcore Codeception Framework
env:
MATRIX_PIMCORE_VERSION: ${{ matrix.pimcore }}
MATRIX_PIMCORE_TEMPLATE_TAG: ${{ matrix.template_tag }}
run: |
git clone -b ${{ env.PIMCORE_CODECEPTION_VERSION }} --single-branch --depth 1 https://github.com/dachcom-digital/pimcore-codeception-framework.git
ls -al pimcore-codeception-framework
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/setup.sh
./pimcore-codeception-framework/src/_etc/scripts/setup.sh

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl
coverage: none

- name: Check PHP Version
run: php -v

- name: Setup MySql
run: |
sudo systemctl start mysql
mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer Downloads
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Composer install
env:
TEST_PIMCORE_VERSION: ${{ matrix.pimcore }}
TEST_SYMFONY_VERSION: ${{ matrix.symfony }}
run: |
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh
./pimcore-codeception-framework/src/_etc/scripts/composer.sh

- name: Assets Install
run: |
bin/console assets:install public --relative --symlink

- name: Easy Coding Standard Check
continue-on-error: true
run: |
bin/console cache:warmup --env=test
vendor/bin/ecs check ${{ github.workspace }}/lib/test-bundle/src --config ${{ github.workspace }}/lib/test-bundle/ecs.php
116 changes: 116 additions & 0 deletions .github/workflows/php-stan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: PHP Stan
on:
push:
branches: [ 'master' ]
pull_request:
branches: [ 'master' ]

jobs:
stan:
runs-on: ubuntu-latest
env:
TEST_BUNDLE_NAME: "SecureStorageBundle"
TEST_BUNDLE_INSTALLER_CLASS: false
TEST_BUNDLE_TEST_DIR: "${{ github.workspace }}/lib/test-bundle/tests"
TEST_PROJECT_ROOT_DIR: "${{ github.workspace }}"

PIMCORE_CODECEPTION_FRAMEWORK: "${{ github.workspace }}/pimcore-codeception-framework"
PIMCORE_CODECEPTION_VERSION: "3.0"

APP_ENV: test
PIMCORE_TEST_DB_DSN: "mysql://root:[email protected]:3306/dachcom_bundle_test"
PIMCORE_TEST_URL: "http://localhost"

SYMFONY_DEPRECATIONS_HELPER: "weak"
PIMCORE_PHP_ERROR_REPORTING: 32767

WEBDRIVER_HOST: localhost
WEBDRIVER_URL: "http://localhost:8080/"

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: [ 8.3 ]
symfony: [ ^6.4 ]
pimcore: [ ~11.3.0 ]
include:
- pimcore: ~11.3.0
template_tag: v2024.2.1
steps:
- uses: actions/checkout@v2
with:
path: lib/test-bundle

- name: Generate Application Structure
run: |
git clone -b ${{ matrix.template_tag }} --single-branch --depth 1 https://github.com/pimcore/skeleton.git
mv skeleton/composer.json .
mv skeleton/bin .
mv skeleton/config .
mv skeleton/public .
mv skeleton/src .
mv skeleton/templates .
mv skeleton/var .
rm -r skeleton

- name: Setup Pimcore Codeception Framework
env:
MATRIX_PIMCORE_VERSION: ${{ matrix.pimcore }}
MATRIX_PIMCORE_TEMPLATE_TAG: ${{ matrix.template_tag }}
run: |
git clone -b ${{ env.PIMCORE_CODECEPTION_VERSION }} --single-branch --depth 1 https://github.com/dachcom-digital/pimcore-codeception-framework.git
ls -al pimcore-codeception-framework
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/setup.sh
./pimcore-codeception-framework/src/_etc/scripts/setup.sh

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl
coverage: none

- name: Check PHP Version
run: php -v

- name: Setup MySql
run: |
sudo systemctl start mysql
mysql -uroot -proot -h127.0.0.1 -e "CREATE DATABASE dachcom_bundle_test CHARSET=utf8mb4;"

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer Downloads
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Composer install
env:
TEST_PIMCORE_VERSION: ${{ matrix.pimcore }}
TEST_SYMFONY_VERSION: ${{ matrix.symfony }}
run: |
chmod +x ./pimcore-codeception-framework/src/_etc/scripts/composer.sh
./pimcore-codeception-framework/src/_etc/scripts/composer.sh

- name: Assets Install
run: |
bin/console assets:install public --relative --symlink

- name: Php Stan
run: |
bin/console cache:warmup --env=test
vendor/bin/phpstan analyse -c${{ github.workspace }}/lib/test-bundle/phpstan.neon -a ${{ github.workspace }}/lib/test-bundle/tests/_phpstan-bootstrap.php ${{ github.workspace }}/lib/test-bundle/src -l 4
Loading
Loading