mirror of
https://github.com/jbcr/SyliusGDPRPlugin.git
synced 2026-03-25 09:22:19 +01:00
248 lines
8.8 KiB
YAML
248 lines
8.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- README.md
|
|
pull_request:
|
|
paths-ignore:
|
|
- README.md
|
|
|
|
jobs:
|
|
php:
|
|
name: PHP ${{ matrix.php }} Symfony ${{ matrix.symfony }}
|
|
runs-on: ubuntu-18.04
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php: [7.3, 7.4]
|
|
symfony: [4.4.*, 5.2.*]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: "${{ matrix.php }}"
|
|
tools: symfony
|
|
coverage: none
|
|
|
|
- name: Composer - Update to composer 2
|
|
id: composer-2
|
|
run: composer self-update --2
|
|
|
|
- name: Composer - Get Cache Directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Composer - Set cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }}
|
|
restore-keys: |
|
|
php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-composer-
|
|
- name: Composer - Validate composer.json and composer.lock
|
|
run: composer validate --strict
|
|
|
|
- name: Composer - Github Auth
|
|
run: composer config -g github-oauth.github.com ${{ github.token }}
|
|
|
|
- name: Composer - Restrict Symfony version
|
|
run: composer config extra.symfony.require "${{ matrix.symfony }}"
|
|
|
|
- name: Composer - Update dependencies
|
|
run: composer update --no-progress
|
|
id: end-of-setup
|
|
|
|
- name: ECS - Run
|
|
run: if [ -f ruleset/ecs.php ]; then vendor/bin/ecs check src/ --no-progress-bar -c ruleset/ecs.php ; else echo Ecs ruleset file does not exist, skipping step ; fi
|
|
if: always() && steps.end-of-setup.outcome == 'success'
|
|
|
|
- name: PHPStan - Run
|
|
run: if [ -f ruleset/phpstan.neon ]; then vendor/bin/phpstan analyse -c ruleset/phpstan.neon src/ ; else echo PHPStan ruleset file does not exist, skipping step ; fi
|
|
if: always() && steps.end-of-setup.outcome == 'success'
|
|
|
|
- name: PHPMD - Run
|
|
run: if [ -f ruleset/.php_md.xml ]; then vendor/bin/phpmd src ansi ruleset/.php_md.xml ; else echo PHPMD config file does not exist, skipping step ; fi
|
|
if: always() && steps.end-of-setup.outcome == 'success'
|
|
|
|
- name: GrumPHP - Run
|
|
run: (test -f grumphp.yml && vendor/bin/grumphp run) || echo Grumphp ruleset file does not exist, skipping step
|
|
if: always() && steps.end-of-setup.outcome == 'success'
|
|
|
|
- name: Checks security issues - Run
|
|
run: symfony security:check
|
|
if: always() && steps.end-of-setup.outcome == 'success'
|
|
|
|
sylius:
|
|
name: PHPUnit (PHP ${{ matrix.php }} Sylius ${{ matrix.sylius }})
|
|
runs-on: ubuntu-18.04
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
php: [7.3, 7.4]
|
|
sylius: [1.8.*, 1.9.*]
|
|
symfony: [4.4.*, 5.2.*]
|
|
node: [10.x]
|
|
exclude:
|
|
- sylius: 1.8.*
|
|
symfony: 5.2.*
|
|
- sylius: 1.9.*
|
|
symfony: 4.4.*
|
|
|
|
env:
|
|
APP_ENV: test
|
|
package-name: synolia/sylius-gdpr-plugin
|
|
|
|
steps:
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: "${{ matrix.php }}"
|
|
ini-values: date.timezone=UTC
|
|
extensions: intl
|
|
tools: symfony
|
|
coverage: none
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: "${{ matrix.node }}"
|
|
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
path: plugin
|
|
|
|
- name: Composer - Update to composer 2
|
|
id: composer-2
|
|
run: composer self-update --2
|
|
|
|
- name: Composer - Get Cache Directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Composer - Set cache
|
|
uses: actions/cache@v2
|
|
id: cache-composer
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: php-${{ matrix.php }}-sylius-${{ matrix.sylius }}-symfony-${{ matrix.symfony }}-composer-${{ hashFiles('**/composer.json') }}
|
|
restore-keys: php-${{ matrix.php }}-sylius-${{ matrix.sylius }}-symfony-${{ matrix.symfony }}-composer-
|
|
|
|
- name: Composer - Create cache directory
|
|
run: mkdir -p /home/runner/.composer/cache
|
|
if: steps.cache-composer.outputs.cache-hit != 'true'
|
|
|
|
- name: Composer - Github Auth
|
|
run: composer config -g github-oauth.github.com ${{ github.token }}
|
|
|
|
- name: Composer - Install Sylius-Standard
|
|
run: composer create-project --no-progress sylius/sylius-standard sylius "${{ matrix.sylius }}"
|
|
|
|
- name: Composer - Add path repository
|
|
working-directory: ./sylius
|
|
run: |
|
|
composer config repositories.plugin '{"type": "path", "url": "../plugin/"}'
|
|
- name: Composer - Config
|
|
working-directory: ./sylius
|
|
run: |
|
|
composer config extra.symfony.allow-contrib true
|
|
composer config minimum-stability "dev"
|
|
composer config prefer-stable true
|
|
- name: Composer - Restrict Symfony version
|
|
working-directory: ./sylius
|
|
run: composer config extra.symfony.require "${{ matrix.symfony }}"
|
|
|
|
- name: Composer - Install plugin
|
|
working-directory: ./sylius
|
|
run: composer req "${{ env.package-name }}:*" --prefer-source --no-scripts
|
|
|
|
- name: Sylius - Update dependencies # need to update sylius version
|
|
working-directory: ./sylius
|
|
run: |
|
|
composer update --no-progress --no-scripts --prefer-dist
|
|
composer update --no-suggest -n -o
|
|
- name: Sylius - Run Symfony flex
|
|
working-directory: ./sylius
|
|
run: composer sync-recipes
|
|
|
|
- name: Sylius - Set database config
|
|
working-directory: ./sylius
|
|
run: |
|
|
echo 'DATABASE_URL=mysql://root:@127.0.0.1:3306/gdpr_plugin_%kernel.environment%?serverVersion=mariadb-10.4.11' >> .env
|
|
|
|
- name: Sylius - Install
|
|
working-directory: ./sylius
|
|
run: php bin/console sylius:install -n
|
|
|
|
- name: Yarn - Get cache directory
|
|
id: yarn-cache
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
- name: Yarn - Set Cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.yarn-cache.outputs.dir }}
|
|
key: node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }}
|
|
restore-keys: |
|
|
node-${{ matrix.node }}-yarn-
|
|
- name: Sylius - Assets
|
|
working-directory: ./sylius
|
|
run: yarn install && yarn build
|
|
|
|
- name: Sylius - Cache clear
|
|
working-directory: ./sylius
|
|
run: |
|
|
php bin/console c:c
|
|
- name: PHPUnit - Configure
|
|
working-directory: ./sylius
|
|
run: |
|
|
cp vendor/${{ env.package-name }}/phpunit.xml.dist phpunit.xml
|
|
sed -i "s#tests/Application/config/bootstrap.php#config/bootstrap.php#g" phpunit.xml
|
|
sed -i "s#<directory>tests</directory>#<directory>./vendor/${{ env.package-name }}/tests/PHPUnit</directory>#g" phpunit.xml
|
|
sed -i "s#/tests/Application/Kernel.php#src/Kernel.php#g" phpunit.xml
|
|
- name: Output PHP version for Symfony CLI
|
|
working-directory: ./sylius
|
|
run: php -v | head -n 1 | awk '{ print $2 }' > .php-version
|
|
|
|
- name: Install certificates
|
|
working-directory: ./sylius
|
|
run: symfony server:ca:install
|
|
|
|
- name: Run Chrome headless
|
|
working-directory: ./sylius
|
|
run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' https://127.0.0.1 > /dev/null 2>&1 &
|
|
|
|
- name: Run webserver
|
|
working-directory: ./sylius
|
|
run: symfony server:start --port=8080 --dir=public --daemon
|
|
id: end-of-setup-sylius
|
|
|
|
- name: Doctrine Schema Validate - Run
|
|
working-directory: ./sylius
|
|
run: php bin/console doctrine:schema:validate --skip-sync
|
|
if: always() && steps.end-of-setup-sylius.outcome == 'success'
|
|
|
|
- name: PHPunit - Run
|
|
working-directory: ./sylius
|
|
run: vendor/bin/phpunit
|
|
if: always() && steps.end-of-setup-sylius.outcome == 'success'
|
|
|
|
- uses: actions/upload-artifact@v2.1.4
|
|
if: failure()
|
|
with:
|
|
name: logs
|
|
path: ./sylius/etc/build
|
|
|
|
services:
|
|
mariadb:
|
|
image: mariadb:10.4.11
|
|
ports:
|
|
- 3306:3306
|
|
env:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: true
|
|
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |