Skip to content

Commit f6d07ea

Browse files
committed
Update infra for Sylius 1.12
1 parent 010d5d0 commit f6d07ea

File tree

6 files changed

+87
-73
lines changed

6 files changed

+87
-73
lines changed

.github/workflows/recipe.yaml

Lines changed: 32 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,23 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
schedule:
8-
- cron: '0 0 * * 1'
97

108
jobs:
119

1210
recipe:
1311

14-
runs-on: ubuntu-latest
12+
name: Flex recipe (PHP ${{ matrix.php }}, Sylius ${{ matrix.sylius }})
1513

16-
env:
17-
SYMFONY_ENDPOINT: http://127.0.0.1/
14+
runs-on: ubuntu-latest
1815

1916
strategy:
2017
fail-fast: false
2118
matrix:
2219
php: ['7.4' ,'8.0', '8.1']
23-
sylius: ["~1.8.0", "~1.9.0", "~1.10.0", "~1.11.0", "~1.12.0"]
20+
sylius: [ "~1.9.0", "~1.10.0", "~1.11.0", "~1.12.0"]
2421
exclude:
25-
- php: 8.1
26-
sylius: "~1.8.0"
2722
- php: 8.1
2823
sylius: "~1.9.0"
29-
- php: 8.0
30-
sylius: "~1.8.0"
3124
- php: 8.0
3225
sylius: "~1.9.0"
3326
- php: 7.4
@@ -37,32 +30,36 @@ jobs:
3730

3831
steps:
3932
- name: Setup PHP
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php }}
36+
extensions: gd, intl, json
37+
ini-values: date.timezone=UTC
38+
39+
- name: Set project php-version
4040
run: |
41-
sudo update-alternatives --set php /usr/bin/php${{ matrix.php }}
42-
echo "date.timezone=UTC" >> /tmp/timezone.ini
43-
sudo mv /tmp/timezone.ini /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini
4441
echo ${{ matrix.php }} > .php-version
4542
46-
- uses: actions/checkout@v2
43+
- uses: actions/checkout@v3
4744
with:
4845
path: plugin
4946

50-
# Run the server at the start so it can download the recipes!
51-
- name: Run standalone symfony flex server
52-
run: |
53-
echo ${{ github.token }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
54-
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
55-
docker ps
56-
57-
- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
47+
- name: Determine composer cache directory
48+
id: composer-cache-directory
49+
working-directory: plugin
50+
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
5851

59-
- uses: actions/cache@v1
52+
- name: Cache dependencies installed with composer
53+
uses: actions/cache@v3
6054
id: cache-composer
6155
with:
62-
path: /home/runner/.composer/cache
63-
key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ github.sha }}
56+
path: ${{ steps.composer-cache-directory.outputs.directory }}
57+
key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ hashFiles('**/composer.json') }}
6458
restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-
6559

60+
- name: Ensure that composer cache directory exists
61+
run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}
62+
6663
- name: Composer Github Auth
6764
run: composer config -g github-oauth.github.com ${{ github.token }}
6865

@@ -79,21 +76,15 @@ jobs:
7976
- name: Setup some requirements
8077
working-directory: ./sylius
8178
run: |
82-
composer config --no-plugins allow-plugins true
83-
composer config repositories.plugin '{"type": "path", "url": "../plugin/"}'
84-
composer config extra.symfony.allow-contrib true
85-
composer config secure-http false
86-
composer config --unset platform.php
87-
88-
- name: Require plugin without install
79+
composer config --no-plugins allow-plugins true
80+
composer config --no-plugins extra.symfony.allow-contrib true
81+
composer config --no-plugins secure-http false
82+
composer config --no-plugins --unset platform.php
83+
composer config --no-plugins extra.symfony.docker false
84+
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
85+
composer config repositories.plugin '{"type": "path", "url": "../plugin/"}'
86+
87+
- name: Require plugin & install all dependencies
8988
working-directory: ./sylius
9089
run: |
91-
composer require --no-install --no-update monsieurbiz/sylius-sales-reports-plugin="*@dev"
92-
93-
- name: Composer install
94-
working-directory: ./sylius
95-
run: |
96-
composer install
97-
98-
- name: Show flex server logs
99-
run: docker logs --tail 100 flex
90+
composer require monsieurbiz/sylius-sales-reports-plugin="*@dev"

.github/workflows/security.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Security
33
on:
44
push:
55
pull_request:
6-
schedule:
7-
- cron: '0 0 * * 1'
86

97
jobs:
108

119
security:
1210

11+
name: Security check (PHP ${{ matrix.php }})
12+
1313
runs-on: ubuntu-latest
1414

1515
strategy:
@@ -18,33 +18,37 @@ jobs:
1818
php: ['7.4', '8.0', '8.1']
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2222

2323
- name: Setup PHP
2424
uses: shivammathur/setup-php@v2
2525
with:
2626
php-version: ${{ matrix.php }}
27-
28-
- name: Setup PHP part two
27+
ini-values: date.timezone=UTC
28+
29+
- name: Set project php-version
2930
run: |
30-
echo "date.timezone=UTC" | sudo tee /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini
31-
echo "${{ matrix.php }}" > .php-version
31+
echo ${{ matrix.php }} > .php-version
3232
33-
- uses: actions/cache@v1
33+
- name: Determine composer cache directory
34+
id: composer-cache-directory
35+
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
36+
37+
- name: Cache dependencies installed with composer
38+
uses: actions/cache@v3
3439
id: cache-composer
3540
with:
36-
path: /home/runner/.composer/cache
37-
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
41+
path: ${{ steps.composer-cache-directory.outputs.directory }}
42+
key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
3843
restore-keys: composer2-php:${{ matrix.php }}-
3944

40-
- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
45+
- name: Ensure that composer cache directory exists
46+
run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}
4147

4248
- name: Composer Github Auth
4349
run: composer config -g github-oauth.github.com ${{ github.token }}
4450

45-
- uses: actions/checkout@v2
46-
4751
- name: Install PHP dependencies
4852
run: composer update --prefer-dist
4953

50-
- uses: symfonycorp/security-checker-action@v3
54+
- uses: symfonycorp/security-checker-action@v4

.github/workflows/tests.yaml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
push:
55
branches: [ master ]
66
pull_request:
7-
schedule:
8-
- cron: '0 0 * * 1'
97

108
jobs:
119

1210
php:
1311

12+
name: Quality tests (PHP ${{ matrix.php }})
13+
1414
runs-on: ubuntu-latest
1515

1616
strategy:
@@ -24,30 +24,41 @@ jobs:
2424
DOCKER_INTERACTIVE_ARGS: -t
2525

2626
steps:
27-
- uses: actions/checkout@v2
28-
- uses: actions/setup-node@v2
27+
- uses: actions/checkout@v3
28+
29+
- uses: actions/setup-node@v3
2930
with:
3031
node-version: '14'
3132

3233
- name: Setup PHP
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: ${{ matrix.php }}
37+
ini-values: date.timezone=UTC
38+
39+
- name: Set project php-version
3340
run: |
34-
sudo update-alternatives --set php /usr/bin/php${{ matrix.php }}
35-
echo "date.timezone=UTC" | sudo tee /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini
36-
echo "${{ matrix.php }}" > .php-version
41+
echo ${{ matrix.php }} > .php-version
3742
3843
- name: Install symfony CLI
3944
run: |
4045
curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | sudo -E bash
4146
sudo apt install symfony-cli
4247
43-
- uses: actions/cache@v1
48+
- name: Determine composer cache directory
49+
id: composer-cache-directory
50+
run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
51+
52+
- name: Cache dependencies installed with composer
53+
uses: actions/cache@v3
4454
id: cache-composer
4555
with:
46-
path: /home/runner/.composer/cache
47-
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
56+
path: ${{ steps.composer-cache-directory.outputs.directory }}
57+
key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }}
4858
restore-keys: composer2-php:${{ matrix.php }}-
4959

50-
- run: mkdir -p /home/runner/{.composer/cache,.config/composer}
60+
- name: Ensure that composer cache directory exists
61+
run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}
5162

5263
- name: Composer Github Auth
5364
run: composer config -g github-oauth.github.com ${{ github.token }}

.php-version.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.1
1+
8.2

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ setup_application:
7070
(cd ${APP_DIR} && ${COMPOSER} config extra.symfony.allow-contrib true)
7171
(cd ${APP_DIR} && ${COMPOSER} config minimum-stability dev)
7272
(cd ${APP_DIR} && ${COMPOSER} config --no-plugins allow-plugins true)
73+
(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"]')
7374
(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
7475
$(MAKE) ${APP_DIR}/.php-version
7576
$(MAKE) ${APP_DIR}/php.ini
@@ -145,7 +146,7 @@ test.twig: ## Validate Twig templates
145146
### SYLIUS
146147
### ¯¯¯¯¯¯
147148

148-
sylius: dependencies sylius.database sylius.fixtures sylius.assets ## Install Sylius
149+
sylius: dependencies sylius.database sylius.fixtures sylius.assets messenger.setup ## Install Sylius
149150
.PHONY: sylius
150151

151152
sylius.database: ## Setup the database
@@ -161,6 +162,9 @@ sylius.assets: ## Install all assets with symlinks
161162
${CONSOLE} sylius:install:assets
162163
${CONSOLE} sylius:theme:assets:install --symlink
163164

165+
messenger.setup: ## Setup Messenger transports
166+
${CONSOLE} messenger:setup-transports
167+
164168
###
165169
### PLATFORM
166170
### ¯¯¯¯¯¯¯¯

composer.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"mikey179/vfsstream": "^1.6",
2929
"mockery/mockery": "^1.4",
3030
"pamil/prophecy-common": "^0.1",
31-
"phpspec/phpspec": "^7.0",
31+
"phpspec/phpspec": "^6.1 || ^7.2",
3232
"phpstan/phpstan": "^0.12.57",
3333
"phpstan/phpstan-doctrine": "^0.12.19",
3434
"phpstan/phpstan-webmozart-assert": "^0.12.7",
@@ -54,15 +54,19 @@
5454
"cache:clear": "symfony-cmd",
5555
"assets:install %PUBLIC_DIR%": "symfony-cmd"
5656
},
57-
"phpcs": "php-cs-fixer fix --using-cache=false",
57+
"phpcs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --using-cache=no",
5858
"phpstan": "phpstan analyse -c phpstan.neon src/",
5959
"phpmd": "phpmd --exclude Migrations/* src/ ansi phpmd.xml",
6060
"phpunit": "phpunit",
6161
"phpspec": "phpspec run"
6262
},
6363
"extra": {
6464
"symfony": {
65-
"require": "^4.4"
65+
"docker": false,
66+
"endpoint": [
67+
"https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master",
68+
"flex://defaults"
69+
]
6670
},
6771
"branch-alias": {
6872
"dev-master": "1.0-dev"
@@ -72,9 +76,9 @@
7276
"allow-plugins": {
7377
"dealerdirect/phpcodesniffer-composer-installer": true,
7478
"symfony/thanks": true,
75-
"phpstan/extension-installer": true,
7679
"ergebnis/composer-normalize": true,
77-
"symfony/flex": true
80+
"symfony/flex": true,
81+
"php-http/discovery": true
7882
}
7983
}
8084
}

0 commit comments

Comments
 (0)