diff --git a/.github/workflows/recipe.yaml b/.github/workflows/recipe.yaml index 00cc808..6db3fa6 100644 --- a/.github/workflows/recipe.yaml +++ b/.github/workflows/recipe.yaml @@ -4,30 +4,23 @@ on: push: branches: [ master ] pull_request: - schedule: - - cron: '0 0 * * 1' jobs: recipe: - runs-on: ubuntu-latest + name: Flex recipe (PHP ${{ matrix.php }}, Sylius ${{ matrix.sylius }}) - env: - SYMFONY_ENDPOINT: http://127.0.0.1/ + runs-on: ubuntu-latest strategy: fail-fast: false matrix: php: ['7.4' ,'8.0', '8.1'] - sylius: ["~1.8.0", "~1.9.0", "~1.10.0", "~1.11.0", "~1.12.0"] + sylius: [ "~1.9.0", "~1.10.0", "~1.11.0", "~1.12.0"] exclude: - - php: 8.1 - sylius: "~1.8.0" - php: 8.1 sylius: "~1.9.0" - - php: 8.0 - sylius: "~1.8.0" - php: 8.0 sylius: "~1.9.0" - php: 7.4 @@ -37,32 +30,36 @@ jobs: steps: - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: gd, intl, json + ini-values: date.timezone=UTC + + - name: Set project php-version run: | - sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} - echo "date.timezone=UTC" >> /tmp/timezone.ini - sudo mv /tmp/timezone.ini /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini echo ${{ matrix.php }} > .php-version - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: path: plugin - # Run the server at the start so it can download the recipes! - - name: Run standalone symfony flex server - run: | - echo ${{ github.token }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin - docker run --rm --name flex -d -v $PWD/plugin/recipes:/var/www/flex/var/repo/private/monsieurbiz/sylius-sales-reports-plugin -p 80:80 docker.pkg.github.com/monsieurbiz/docker/symfony-flex-server:latest contrib official - docker ps - - - run: mkdir -p /home/runner/{.composer/cache,.config/composer} + - name: Determine composer cache directory + id: composer-cache-directory + working-directory: plugin + run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT - - uses: actions/cache@v1 + - name: Cache dependencies installed with composer + uses: actions/cache@v3 id: cache-composer with: - path: /home/runner/.composer/cache - key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ github.sha }} + path: ${{ steps.composer-cache-directory.outputs.directory }} + key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ hashFiles('**/composer.json') }} restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}- + - name: Ensure that composer cache directory exists + run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }} + - name: Composer Github Auth run: composer config -g github-oauth.github.com ${{ github.token }} @@ -79,21 +76,15 @@ jobs: - name: Setup some requirements working-directory: ./sylius run: | - composer config --no-plugins allow-plugins true - composer config repositories.plugin '{"type": "path", "url": "../plugin/"}' - composer config extra.symfony.allow-contrib true - composer config secure-http false - composer config --unset platform.php - - - name: Require plugin without install + composer config --no-plugins allow-plugins true + composer config --no-plugins extra.symfony.allow-contrib true + composer config --no-plugins secure-http false + composer config --no-plugins --unset platform.php + composer config --no-plugins extra.symfony.docker false + composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]' + composer config repositories.plugin '{"type": "path", "url": "../plugin/"}' + + - name: Require plugin & install all dependencies working-directory: ./sylius run: | - composer require --no-install --no-update monsieurbiz/sylius-sales-reports-plugin="*@dev" - - - name: Composer install - working-directory: ./sylius - run: | - composer install - - - name: Show flex server logs - run: docker logs --tail 100 flex + composer require monsieurbiz/sylius-sales-reports-plugin="*@dev" diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index ca32a47..4e12805 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -3,13 +3,13 @@ name: Security on: push: pull_request: - schedule: - - cron: '0 0 * * 1' jobs: security: + name: Security check (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest strategy: @@ -18,33 +18,37 @@ jobs: php: ['7.4', '8.0', '8.1'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - - - name: Setup PHP part two + ini-values: date.timezone=UTC + + - name: Set project php-version run: | - echo "date.timezone=UTC" | sudo tee /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini - echo "${{ matrix.php }}" > .php-version + echo ${{ matrix.php }} > .php-version - - uses: actions/cache@v1 + - name: Determine composer cache directory + id: composer-cache-directory + run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies installed with composer + uses: actions/cache@v3 id: cache-composer with: - path: /home/runner/.composer/cache - key: composer2-php:${{ matrix.php }}-${{ github.sha }} + path: ${{ steps.composer-cache-directory.outputs.directory }} + key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }} restore-keys: composer2-php:${{ matrix.php }}- - - run: mkdir -p /home/runner/{.composer/cache,.config/composer} + - name: Ensure that composer cache directory exists + run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }} - name: Composer Github Auth run: composer config -g github-oauth.github.com ${{ github.token }} - - uses: actions/checkout@v2 - - name: Install PHP dependencies run: composer update --prefer-dist - - uses: symfonycorp/security-checker-action@v3 + - uses: symfonycorp/security-checker-action@v4 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fe74980..4bf7505 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -4,13 +4,13 @@ on: push: branches: [ master ] pull_request: - schedule: - - cron: '0 0 * * 1' jobs: php: + name: Quality tests (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest strategy: @@ -24,30 +24,41 @@ jobs: DOCKER_INTERACTIVE_ARGS: -t steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 with: node-version: '14' - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: date.timezone=UTC + + - name: Set project php-version run: | - sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} - echo "date.timezone=UTC" | sudo tee /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini - echo "${{ matrix.php }}" > .php-version + echo ${{ matrix.php }} > .php-version - name: Install symfony CLI run: | curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | sudo -E bash sudo apt install symfony-cli - - uses: actions/cache@v1 + - name: Determine composer cache directory + id: composer-cache-directory + run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies installed with composer + uses: actions/cache@v3 id: cache-composer with: - path: /home/runner/.composer/cache - key: composer2-php:${{ matrix.php }}-${{ github.sha }} + path: ${{ steps.composer-cache-directory.outputs.directory }} + key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }} restore-keys: composer2-php:${{ matrix.php }}- - - run: mkdir -p /home/runner/{.composer/cache,.config/composer} + - name: Ensure that composer cache directory exists + run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }} - name: Composer Github Auth run: composer config -g github-oauth.github.com ${{ github.token }} diff --git a/.php-version.dist b/.php-version.dist index b8eb026..2983cad 100644 --- a/.php-version.dist +++ b/.php-version.dist @@ -1 +1 @@ -8.1 +8.2 diff --git a/Makefile b/Makefile index 1897fa8..4004253 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,7 @@ setup_application: (cd ${APP_DIR} && ${COMPOSER} config extra.symfony.allow-contrib true) (cd ${APP_DIR} && ${COMPOSER} config minimum-stability dev) (cd ${APP_DIR} && ${COMPOSER} config --no-plugins allow-plugins true) + (cd ${APP_DIR} && ${COMPOSER} config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]') (cd ${APP_DIR} && ${COMPOSER} require --no-install --no-scripts --no-progress sylius/sylius="~${SYLIUS_VERSION}") # Make sure to install the required version of sylius because the sylius-standard has a soft constraint $(MAKE) ${APP_DIR}/.php-version $(MAKE) ${APP_DIR}/php.ini @@ -145,7 +146,7 @@ test.twig: ## Validate Twig templates ### SYLIUS ### ¯¯¯¯¯¯ -sylius: dependencies sylius.database sylius.fixtures sylius.assets ## Install Sylius +sylius: dependencies sylius.database sylius.fixtures sylius.assets messenger.setup ## Install Sylius .PHONY: sylius sylius.database: ## Setup the database @@ -161,6 +162,9 @@ sylius.assets: ## Install all assets with symlinks ${CONSOLE} sylius:install:assets ${CONSOLE} sylius:theme:assets:install --symlink +messenger.setup: ## Setup Messenger transports + ${CONSOLE} messenger:setup-transports + ### ### PLATFORM ### ¯¯¯¯¯¯¯¯ diff --git a/composer.json b/composer.json index dd4c642..8e5cca6 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.4", "pamil/prophecy-common": "^0.1", - "phpspec/phpspec": "^7.0", + "phpspec/phpspec": "^6.1 || ^7.2", "phpstan/phpstan": "^0.12.57", "phpstan/phpstan-doctrine": "^0.12.19", "phpstan/phpstan-webmozart-assert": "^0.12.7", @@ -54,7 +54,7 @@ "cache:clear": "symfony-cmd", "assets:install %PUBLIC_DIR%": "symfony-cmd" }, - "phpcs": "php-cs-fixer fix --using-cache=false", + "phpcs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --using-cache=no", "phpstan": "phpstan analyse -c phpstan.neon src/", "phpmd": "phpmd --exclude Migrations/* src/ ansi phpmd.xml", "phpunit": "phpunit", @@ -62,7 +62,11 @@ }, "extra": { "symfony": { - "require": "^4.4" + "docker": false, + "endpoint": [ + "https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master", + "flex://defaults" + ] }, "branch-alias": { "dev-master": "1.0-dev" @@ -72,9 +76,9 @@ "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true, "symfony/thanks": true, - "phpstan/extension-installer": true, "ergebnis/composer-normalize": true, - "symfony/flex": true + "symfony/flex": true, + "php-http/discovery": true } } }