diff --git a/.github/workflows/behat.yml b/.github/workflows/behat.yml new file mode 100644 index 0000000000..2ca833b505 --- /dev/null +++ b/.github/workflows/behat.yml @@ -0,0 +1,84 @@ +name: Behat +on: + push: + branches: [ master, '3.0' ] + pull_request: + branches: [ master, '3.0' ] + +jobs: + behat: + runs-on: ubuntu-latest + env: + PIMCORE_ENVIRONMENT: "test" + CORESHOP_TEST: 1 + PIMCORE_TEST_DB_DSN: "mysql://root:root@localhost/coreshop_test" + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: coreshop_test + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + strategy: + matrix: + php: [7.2, 7.3, 7.4] + symfony: [~3.4, ^4.0] + pimcore: [~6.5.0, dev-master] + + steps: + - uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl + + - name: Check PHP Version + run: php -v + + - name: Start mysql service + run: sudo /etc/init.d/mysql start + + - name: Verify MySQL connection from host + run: | + sudo apt-get install -y mysql-client + mysql -uroot -h127.0.0.1 -proot -e "SHOW DATABASES" + + - name: Setup mysql + run: | + mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_file_format=Barracuda;" + mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_large_prefix=1;" + mysql -uroot -h127.0.0.1 -proot -e "CREATE DATABASE coreshop_test CHARSET=utf8mb4;" + + - name: Copy parameters.yml + run: cp app/config/parameters.example.yml app/config/parameters.yml + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + 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 + run: | + composer config minimum-stability dev + composer config prefer-stable true + composer req pimcore/pimcore:${{ matrix.pimcore }} symfony/symfony:${{ matrix.symfony }} --no-interaction --no-scripts --no-update + composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader + + - name: Cache clear + run: bin/console cache:clear + + - name: Assets Install + run: bin/console assets:install --symlink web + + - name: Run Behat + run: vendor/bin/behat --strict --no-interaction -vvv -f progress --config behat.yml.dist diff --git a/.github/workflows/composer_validate.yml b/.github/workflows/composer_validate.yml new file mode 100644 index 0000000000..bedbbe58c3 --- /dev/null +++ b/.github/workflows/composer_validate.yml @@ -0,0 +1,26 @@ +name: Composer Validate +on: + push: + branches: [ master, '3.0' ] + pull_request: + branches: [ master, '3.0' ] + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Validate composer.json in packages + run: | + packages="$(find "src/CoreShop" -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \;)" + + for package in $packages + do + echo "Validating Package" "$(basename "$package")" + composer validate --ansi --strict $package/composer.json + done diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..2d4b409c4d --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,68 @@ +name: Lint +on: + push: + branches: [ master, '3.0' ] + pull_request: + branches: [ master, '3.0' ] + +jobs: + lint: + runs-on: ubuntu-latest + env: + PIMCORE_ENVIRONMENT: "test" + PIMCORE_TEST_DB_DSN: "mysql://root:root@localhost/coreshop_test" + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: coreshop_test + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.2 + extensions: intl + + - name: Copy parameters.yml + run: cp app/config/parameters.example.yml app/config/parameters.yml + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Start mysql service + run: sudo /etc/init.d/mysql start + + - name: Verify MySQL connection from host + run: | + sudo apt-get install -y mysql-client + mysql -uroot -h127.0.0.1 -proot -e "SHOW DATABASES" + + - name: Setup mysql + run: | + mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_file_format=Barracuda;" + mysql -uroot -h127.0.0.1 -proot -e "SET GLOBAL innodb_large_prefix=1;" + mysql -uroot -h127.0.0.1 -proot -e "CREATE DATABASE coreshop_test CHARSET=utf8mb4;" + + - name: Composer install + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Validate YAML + run: bin/console lint:yaml src --no-debug + + - name: Validate TWIG + run: bin/console lint:twig src --no-debug