Skip to content

Commit df95c16

Browse files
committed
Copy generic CI/CD files
1 parent 8a964c0 commit df95c16

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/static-tests.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Magento 2 Static Tests
22
on: ['push', 'pull_request']
33

44
jobs:
5-
static-tests:
6-
name: Magento 2 Static Tests
5+
phpstan:
6+
name: Magento PHPStan
77
#runs-on: self-hosted
88
runs-on: ubuntu-latest
99
container:
@@ -16,23 +16,30 @@ jobs:
1616
run: |
1717
test -n "${{ secrets.GITLAB_TOKEN }}" || exit 0
1818
cd /tmp/magento
19+
composer config gitlab-domains gitlab.yireo.com
1920
composer config --auth gitlab-token.gitlab.yireo.com ${{ secrets.GITLAB_TOKEN }}
2021
composer config repositories.loki-checkout composer https://gitlab.yireo.com/api/v4/group/loki-checkout/-/packages/composer/packages.json
2122
2223
- name: Add module source
2324
run: |
2425
export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'`
26+
export COMPOSER_DEV_REQUIREMENTS=`jq -r '.["require-dev"] // {} | to_entries | map("\(.key):\(.value)") | join(" ")' composer.json`
2527
cp -R ${GITHUB_WORKSPACE} /tmp/magento/package-source
2628
cd /tmp/magento
2729
composer config repositories.local-source path package-source/
2830
composer config --no-plugins allow-plugins true
31+
composer remove --dev magento/magento-coding-standard
32+
test -z "$COMPOSER_DEV_REQUIREMENTS" || composer require --dev $COMPOSER_DEV_REQUIREMENTS
33+
composer require --dev --prefer-source -- phpstan/phpstan:^2.0 bitexpert/phpstan-magento:^0.42 phpstan/extension-installer
2934
composer require --prefer-source -- ${COMPOSER_NAME}:@dev yireo/magento2-integration-test-helper
30-
composer require --dev --prefer-source -- phpstan/phpstan bitexpert/phpstan-magento phpstan/extension-installer
3135
3236
- name: Run Magento 2 PHPStan Tests
3337
run: |
3438
export COMPOSER_NAME=`cat .module.ini | grep COMPOSER_NAME | cut -f2 -d= | tr -d '"'`
35-
export LEVEL=$(jq -r '.phpstan_level // 1' MODULE.json)
39+
export PHPSTAN_LEVEL=$(jq -r '.phpstan_level // 1' MODULE.json)
40+
test -z "$PHPSTAN_LEVEL" && PHPSTAN_LEVEL=1
3641
test -f /tmp/magento/phpstan.neon || echo 'parameters:' > /tmp/magento/phpstan.neon
37-
php -d memory_limit=4G /tmp/magento/vendor/bin/phpstan analyse --level $LEVEL ${GITHUB_WORKSPACE}
42+
echo "Testing for PHPStan level $PHPSTAN_LEVEL"
43+
cd /tmp/magento
44+
php -d memory_limit=4G vendor/bin/phpstan analyse --level $PHPSTAN_LEVEL ${GITHUB_WORKSPACE}
3845

0 commit comments

Comments
 (0)