From daa9753e5cc5654cf2c13cc1cd43d2af1222635f Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Mon, 18 Jan 2021 23:34:27 +0200 Subject: [PATCH 01/21] Add GH action CI --- .github/workflows/ci.yml | 105 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..67bf49ac4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,105 @@ +name: CI +on: [push, pull_request] +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.1', '7.2', '7.3', '7.4'] + experimental: [false] + include: + - php: 7.1 + symfony_version: 4.3.* + phpstan: true + - php: 7.1 + symfony_version: 4.3.* + php_cs_fixer: true + - php: 7.1 + symfony_version: 4.3.* + unit_tests: true + - php: 7.2 + symfony_version: 4.3.* + unit_tests: true + - php: 7.2 + symfony_version: 5.0.* + unit_tests: true + - php: 7.3 + symfony_version: 4.3.* + unit_tests: true + - php: 7.3 + symfony_version: 4.4.* + unit_tests: true + - php: 7.3 + symfony_version: 5.0.* + unit_tests: true + - php: 7.4 + symfony_version: 4.3.* + unit_tests: true + - php: 7.4 + symfony_version: 4.4.* + unit_tests: true + - php: 7.4 + symfony_version: 5.0.* + unit_tests: true + - php: 7.1 + symfony_version: 4.3.* + functional_tests: true + prepare_container: true + - php: 7.3 + symfony_version: 5.0.* + functional_tests: true + prepare_container: true + - php: 7.1 + symfony_version: 4.3.* + rdkafka_tests: true + prepare_container: true + experimental: true + name: PHP ${{ matrix.php }} tests on Symfony ${{ matrix.symfony_version }} + env: + SYMFONY_VERSION: ${{ matrix.symfony_version }} + PHPSTAN: ${{ matrix.phpstan }} + PHP_CS_FIXER: ${{ matrix.php_cs_fixer }} + UNIT_TESTS: ${{ matrix.unit_tests }} + FUNCTIONAL_TESTS: ${{ matrix.functional_tests }} + PREPARE_CONTAINER: ${{ matrix.prepare_container }} + RDKAFKA_TESTS: ${{ matrix.rdkafka_tests }} + steps: + - uses: actions/checkout@v2 + + - uses: actions/cache@v2 + with: + path: ~/.composer/cache + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: mongodb, redis, :xdebug + ini-values: memory_limit=2048M + + - run: php ./bin/fix-symfony-version.php "${{ matrix.symfony_version }}" + + - run: composer install + + - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php + + - run: bin/dev + if: ${{ matrix.prepare_container == true }} + + - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection + if: ${{ matrix.php_cs_fixer == true }} + + - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon + if: ${{ matrix.phpstan == true }} + + - run: bin/phpunit --exclude-group=functional + if: ${{ matrix.unit_tests == true }} + + - run: bin/test.sh --exclude-group=rdkafka + if: ${{ matrix.functional_tests == true }} + + - run: then bin/test.sh --group=rdkafka + if: ${{ matrix.rdkafka == true }} From bfebe07eb007443fe36326e4c21a8138ada1a011 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Mon, 18 Jan 2021 23:41:46 +0200 Subject: [PATCH 02/21] Fix the matrix --- .github/workflows/ci.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67bf49ac4..41440feae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,6 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['7.1', '7.2', '7.3', '7.4'] experimental: [false] include: - php: 7.1 @@ -54,15 +53,7 @@ jobs: rdkafka_tests: true prepare_container: true experimental: true - name: PHP ${{ matrix.php }} tests on Symfony ${{ matrix.symfony_version }} - env: - SYMFONY_VERSION: ${{ matrix.symfony_version }} - PHPSTAN: ${{ matrix.phpstan }} - PHP_CS_FIXER: ${{ matrix.php_cs_fixer }} - UNIT_TESTS: ${{ matrix.unit_tests }} - FUNCTIONAL_TESTS: ${{ matrix.functional_tests }} - PREPARE_CONTAINER: ${{ matrix.prepare_container }} - RDKAFKA_TESTS: ${{ matrix.rdkafka_tests }} + name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, phpstan=${{ matrix.phpstan }}, cs=${{ matrix.php_cs_fixer }}, unit=${{ matrix.unit_tests }}, func=${{ matrix.functional_tests }}, rdkafka=${{ matrix.rdkafka_tests }} steps: - uses: actions/checkout@v2 From ddd055b3b32103f9bc7517db7688595fa7bca395 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Mon, 18 Jan 2021 23:45:34 +0200 Subject: [PATCH 03/21] Fix stan --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41440feae..812c242bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection if: ${{ matrix.php_cs_fixer == true }} - - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon + - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon pkg if: ${{ matrix.phpstan == true }} - run: bin/phpunit --exclude-group=functional From 81e0b807ce1c50a2be7dd5e0ed338e5086289a19 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Mon, 18 Jan 2021 23:51:12 +0200 Subject: [PATCH 04/21] Fix prepare container --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 812c242bb..a58e25464 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - - run: bin/dev + - run: bin/dev -b if: ${{ matrix.prepare_container == true }} - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection From cb71b183e183b21846fdd5cc214e743f2fead366 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Mon, 18 Jan 2021 23:57:54 +0200 Subject: [PATCH 05/21] Fix rdkafka matrix var --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a58e25464..4a81dba0a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,4 +93,4 @@ jobs: if: ${{ matrix.functional_tests == true }} - run: then bin/test.sh --group=rdkafka - if: ${{ matrix.rdkafka == true }} + if: ${{ matrix.rdkafka_tests == true }} From 2b814097c17d76bd52e631721840c6f091bddacb Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:03:52 +0200 Subject: [PATCH 06/21] Derp --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a81dba0a..d6f7a2924 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,12 @@ jobs: strategy: matrix: experimental: [false] + phpstan: [false] + php_cs_fixer: [false] + unit_tests: [false] + functional_tests: [false] + prepare_container: [false] + rdkafka_tests: [false] include: - php: 7.1 symfony_version: 4.3.* @@ -92,5 +98,5 @@ jobs: - run: bin/test.sh --exclude-group=rdkafka if: ${{ matrix.functional_tests == true }} - - run: then bin/test.sh --group=rdkafka + - run: bin/test.sh --group=rdkafka if: ${{ matrix.rdkafka_tests == true }} From e80adf3d4fd43189208015580efefc1871cddde3 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:07:31 +0200 Subject: [PATCH 07/21] Restore sf ver env var --- .github/workflows/ci.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6f7a2924..fae9f34e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,8 @@ jobs: strategy: matrix: experimental: [false] - phpstan: [false] - php_cs_fixer: [false] + stan: [false] + cs_fixer: [false] unit_tests: [false] functional_tests: [false] prepare_container: [false] @@ -15,10 +15,10 @@ jobs: include: - php: 7.1 symfony_version: 4.3.* - phpstan: true + stan: true - php: 7.1 symfony_version: 4.3.* - php_cs_fixer: true + cs_fixer: true - php: 7.1 symfony_version: 4.3.* unit_tests: true @@ -59,7 +59,11 @@ jobs: rdkafka_tests: true prepare_container: true experimental: true - name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, phpstan=${{ matrix.phpstan }}, cs=${{ matrix.php_cs_fixer }}, unit=${{ matrix.unit_tests }}, func=${{ matrix.functional_tests }}, rdkafka=${{ matrix.rdkafka_tests }} + + name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, phpstan=${{ matrix.stan }}, cs=${{ matrix.cs_fixer }}, unit=${{ matrix.unit_tests }}, func=${{ matrix.functional_tests }}, rdkafka=${{ matrix.rdkafka_tests }} + env: + SYMFONY_VERSION: ${{ matrix.symfony_version }} + steps: - uses: actions/checkout@v2 @@ -87,10 +91,10 @@ jobs: if: ${{ matrix.prepare_container == true }} - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection - if: ${{ matrix.php_cs_fixer == true }} + if: ${{ matrix.cs_fixer == true }} - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon pkg - if: ${{ matrix.phpstan == true }} + if: ${{ matrix.stan == true }} - run: bin/phpunit --exclude-group=functional if: ${{ matrix.unit_tests == true }} From 3eb6c62c8fcdd9f614fabc57bf36c3a48fe70530 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:11:53 +0200 Subject: [PATCH 08/21] Derp --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fae9f34e3..db9b5d3a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: CI -on: [push, pull_request] +on: [pull_request] jobs: tests: runs-on: ubuntu-latest @@ -61,8 +61,6 @@ jobs: experimental: true name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, phpstan=${{ matrix.stan }}, cs=${{ matrix.cs_fixer }}, unit=${{ matrix.unit_tests }}, func=${{ matrix.functional_tests }}, rdkafka=${{ matrix.rdkafka_tests }} - env: - SYMFONY_VERSION: ${{ matrix.symfony_version }} steps: - uses: actions/checkout@v2 From 510de404d365367465e4a326ef4b88b5dbc65a12 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:20:55 +0200 Subject: [PATCH 09/21] Try tog et rid of empty php and sf ver --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db9b5d3a5..0e60e1db8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: + php: [false] + symfony_version: [false] experimental: [false] stan: [false] cs_fixer: [false] From d188977d7c74493d3ba33418d937128207af40d2 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:23:33 +0200 Subject: [PATCH 10/21] Less composer output --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e60e1db8..e3aba4dba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,7 +83,7 @@ jobs: - run: php ./bin/fix-symfony-version.php "${{ matrix.symfony_version }}" - - run: composer install + - run: composer install --no-progress - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php From 1dba3806dd9ec6ac8144f87d78c002d233f89c7a Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:29:25 +0200 Subject: [PATCH 11/21] Try defined versions first --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3aba4dba..492b1825e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,8 +5,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [false] - symfony_version: [false] + php: ['7.4'] + symfony_version: ['4.3.*'] experimental: [false] stan: [false] cs_fixer: [false] From 35c17debd1bd8e0be91563bf0dfbd648ed688f1d Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:41:24 +0200 Subject: [PATCH 12/21] Fix composer cache --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 492b1825e..4daf85d74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,10 +67,15 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v2 with: - path: ~/.composer/cache - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: | ${{ runner.os }}-composer- From 52954c7583fe8c824358ad47695e39dca0b5634a Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:46:01 +0200 Subject: [PATCH 13/21] Fix cs fixer --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4daf85d74..422bae389 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,7 +95,7 @@ jobs: - run: bin/dev -b if: ${{ matrix.prepare_container == true }} - - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection + - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v if: ${{ matrix.cs_fixer == true }} - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon pkg From e352ba1e8ec5bc36fa9b789ad2041f33475654a1 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 00:54:55 +0200 Subject: [PATCH 14/21] Split jobs --- .github/workflows/ci.yml | 98 ++++++++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 422bae389..3ebfcba58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,66 @@ name: CI on: [pull_request] jobs: + static_analysis: + name: Static analysis + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + - uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-composer- + + - uses: shivammathur/setup-php@v2 + with: + php-version: '7.1' + coverage: none + extensions: mongodb, redis, :xdebug + ini-values: memory_limit=2048M + + - run: php ./bin/fix-symfony-version.php "4.3.*" + - run: composer install --no-progress + - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php + - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon pkg + + code_style_check: + name: Code style check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + + - uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-composer- + + - uses: shivammathur/setup-php@v2 + with: + php-version: '7.1' + coverage: none + extensions: mongodb, redis, :xdebug + ini-values: memory_limit=2048M + + - run: php ./bin/fix-symfony-version.php "4.3.*" + - run: composer install --no-progress + - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php + - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v + tests: runs-on: ubuntu-latest strategy: @@ -8,61 +68,47 @@ jobs: php: ['7.4'] symfony_version: ['4.3.*'] experimental: [false] - stan: [false] - cs_fixer: [false] - unit_tests: [false] + unit_tests: [true] functional_tests: [false] prepare_container: [false] rdkafka_tests: [false] include: - php: 7.1 symfony_version: 4.3.* - stan: true - - php: 7.1 - symfony_version: 4.3.* - cs_fixer: true - - php: 7.1 - symfony_version: 4.3.* - unit_tests: true - php: 7.2 symfony_version: 4.3.* - unit_tests: true - php: 7.2 symfony_version: 5.0.* - unit_tests: true - php: 7.3 symfony_version: 4.3.* - unit_tests: true - php: 7.3 symfony_version: 4.4.* - unit_tests: true - php: 7.3 symfony_version: 5.0.* - unit_tests: true - php: 7.4 symfony_version: 4.3.* - unit_tests: true - php: 7.4 symfony_version: 4.4.* - unit_tests: true - php: 7.4 symfony_version: 5.0.* - unit_tests: true - php: 7.1 symfony_version: 4.3.* + unit_tests: false functional_tests: true prepare_container: true - php: 7.3 symfony_version: 5.0.* + unit_tests: false functional_tests: true prepare_container: true - php: 7.1 symfony_version: 4.3.* + unit_tests: false rdkafka_tests: true prepare_container: true experimental: true - name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, phpstan=${{ matrix.stan }}, cs=${{ matrix.cs_fixer }}, unit=${{ matrix.unit_tests }}, func=${{ matrix.functional_tests }}, rdkafka=${{ matrix.rdkafka_tests }} + name: PHP ${{ matrix.php }} tests on Sf ${{ matrix.symfony_version }}, unit=${{ matrix.unit_tests }}, func=${{ matrix.functional_tests }}, rdkafka=${{ matrix.rdkafka_tests }} steps: - uses: actions/checkout@v2 @@ -93,19 +139,13 @@ jobs: - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - run: bin/dev -b - if: ${{ matrix.prepare_container == true }} - - - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v - if: ${{ matrix.cs_fixer == true }} - - - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon pkg - if: ${{ matrix.stan == true }} + if: matrix.prepare_container - run: bin/phpunit --exclude-group=functional - if: ${{ matrix.unit_tests == true }} + if: matrix.unit_tests - run: bin/test.sh --exclude-group=rdkafka - if: ${{ matrix.functional_tests == true }} + if: matrix.functional_tests - run: bin/test.sh --group=rdkafka - if: ${{ matrix.rdkafka_tests == true }} + if: matrix.rdkafka_tests From 58382ad7694ee411ee3b5b527014e0c8cd36e31a Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 01:16:26 +0200 Subject: [PATCH 15/21] Add file diff --- .github/workflows/ci.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ebfcba58..60f6a4c01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set changed files + run: | + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }}..${{ env.GITHUB_SHA }}")" + - name: Get Composer Cache Directory id: composer-cache run: | @@ -29,7 +33,7 @@ jobs: - run: php ./bin/fix-symfony-version.php "4.3.*" - run: composer install --no-progress - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon pkg + - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon --error-format=github -- ${PKG_PHP_CHANGED_FILES[@]} code_style_check: name: Code style check @@ -37,6 +41,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Set changed files + run: | + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }}..${{ env.GITHUB_SHA }}")" + - name: Get Composer Cache Directory id: composer-cache run: | @@ -59,7 +67,7 @@ jobs: - run: php ./bin/fix-symfony-version.php "4.3.*" - run: composer install --no-progress - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v + - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection -- ${PKG_PHP_CHANGED_FILES[@]} tests: runs-on: ubuntu-latest From 845ee13c5966797270fa7ea3db0279e1c2ca2724 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 01:19:36 +0200 Subject: [PATCH 16/21] Add file diff --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60f6a4c01..736167a09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }}..${{ env.GITHUB_SHA }}")" + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }} ${{ env.GITHUB_SHA }}")" - name: Get Composer Cache Directory id: composer-cache @@ -33,7 +33,7 @@ jobs: - run: php ./bin/fix-symfony-version.php "4.3.*" - run: composer install --no-progress - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon --error-format=github -- ${PKG_PHP_CHANGED_FILES[@]} + - run: if [ ! -z "${PKG_PHP_CHANGED_FILES}" ]; then docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon --error-format=github -- ${PKG_PHP_CHANGED_FILES[@]} ; fi code_style_check: name: Code style check @@ -43,7 +43,7 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }}..${{ env.GITHUB_SHA }}")" + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }} ${{ env.GITHUB_SHA }}")" - name: Get Composer Cache Directory id: composer-cache @@ -67,7 +67,7 @@ jobs: - run: php ./bin/fix-symfony-version.php "4.3.*" - run: composer install --no-progress - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection -- ${PKG_PHP_CHANGED_FILES[@]} + - run: if [ ! -z "${PKG_PHP_CHANGED_FILES}" ]; then ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection -- ${PKG_PHP_CHANGED_FILES[@]} ; fi tests: runs-on: ubuntu-latest From 62015f0c3e6986fa3eb58b201b6024b0570a204d Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 01:22:06 +0200 Subject: [PATCH 17/21] Add file diff --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 736167a09..b7fe758e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }} ${{ env.GITHUB_SHA }}")" + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }} ${{ github.sha }}")" - name: Get Composer Cache Directory id: composer-cache @@ -43,7 +43,7 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ env.GITHUB_BASE_REF }} ${{ env.GITHUB_SHA }}")" + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }} ${{ github.sha }}")" - name: Get Composer Cache Directory id: composer-cache From 5adc0dafa7e75ce7586cecc24247819426b801a1 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 01:34:16 +0200 Subject: [PATCH 18/21] Add file diff --- .github/workflows/ci.yml | 6 ++++-- bin/git-find-changed-php-files.sh | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7fe758e0..15538d90f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,8 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }} ${{ github.sha }}")" + echo "ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB ${{ github.base_ref }}..${{ github.sha }});" + echo 'PKG_PHP_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | grep -E "^pkg\/" | grep -E ".*?\.php$");' - name: Get Composer Cache Directory id: composer-cache @@ -43,7 +44,8 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }} ${{ github.sha }}")" + echo "ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB ${{ github.base_ref }}..${{ github.sha }});" + echo 'PKG_PHP_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | grep -E "^pkg\/" | grep -E ".*?\.php$");' - name: Get Composer Cache Directory id: composer-cache diff --git a/bin/git-find-changed-php-files.sh b/bin/git-find-changed-php-files.sh index e256b5f24..bb65a2d7b 100755 --- a/bin/git-find-changed-php-files.sh +++ b/bin/git-find-changed-php-files.sh @@ -12,4 +12,5 @@ IFS=' ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "$1"); PKG_PHP_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | grep -E "^pkg\/" | grep -E ".*?\.php$"); -echo "$PKG_PHP_CHANGED_FILES"; +echo "$ALL_PHP_CHANGED_FILES"; +#echo "$PKG_PHP_CHANGED_FILES"; From e6b418902ff0bb7de409181d81a384eeecbe26ca Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 01:39:14 +0200 Subject: [PATCH 19/21] Add file diff --- .github/workflows/ci.yml | 6 ++---- bin/git-find-changed-php-files.sh | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15538d90f..7cac92a00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,7 @@ jobs: - name: Set changed files run: | - echo "ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB ${{ github.base_ref }}..${{ github.sha }});" - echo 'PKG_PHP_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | grep -E "^pkg\/" | grep -E ".*?\.php$");' + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }}..${{ github.head_ref }}")" - name: Get Composer Cache Directory id: composer-cache @@ -44,8 +43,7 @@ jobs: - name: Set changed files run: | - echo "ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB ${{ github.base_ref }}..${{ github.sha }});" - echo 'PKG_PHP_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | grep -E "^pkg\/" | grep -E ".*?\.php$");' + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }}..${{ github.head_ref }}")" - name: Get Composer Cache Directory id: composer-cache diff --git a/bin/git-find-changed-php-files.sh b/bin/git-find-changed-php-files.sh index bb65a2d7b..e256b5f24 100755 --- a/bin/git-find-changed-php-files.sh +++ b/bin/git-find-changed-php-files.sh @@ -12,5 +12,4 @@ IFS=' ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "$1"); PKG_PHP_CHANGED_FILES=$(echo "$ALL_CHANGED_FILES" | grep -E "^pkg\/" | grep -E ".*?\.php$"); -echo "$ALL_PHP_CHANGED_FILES"; -#echo "$PKG_PHP_CHANGED_FILES"; +echo "$PKG_PHP_CHANGED_FILES"; From 446d1a3c0eb1d4f3b4826e03bba211ef43cf1aa7 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 01:51:14 +0200 Subject: [PATCH 20/21] Add file diff --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cac92a00..ec3c77f8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }}..${{ github.head_ref }}")" + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "origin/${{ github.base_ref }}..${{ github.head_ref }}")" - name: Get Composer Cache Directory id: composer-cache @@ -43,7 +43,7 @@ jobs: - name: Set changed files run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "${{ github.base_ref }}..${{ github.head_ref }}")" + echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "origin/${{ github.base_ref }}..${{ github.head_ref }}")" - name: Get Composer Cache Directory id: composer-cache From b732d967cc58d29952763c775be372255639d7b5 Mon Sep 17 00:00:00 2001 From: Andrew M-Y Date: Tue, 19 Jan 2021 02:01:54 +0200 Subject: [PATCH 21/21] Add file diff --- .github/workflows/ci.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec3c77f8b..92c2a840d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set changed files - run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "origin/${{ github.base_ref }}..${{ github.head_ref }}")" + - uses: technote-space/get-diff-action@v4 + with: + PATTERNS: | + pkg/**/*.php - name: Get Composer Cache Directory id: composer-cache @@ -33,7 +34,9 @@ jobs: - run: php ./bin/fix-symfony-version.php "4.3.*" - run: composer install --no-progress - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - - run: if [ ! -z "${PKG_PHP_CHANGED_FILES}" ]; then docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon --error-format=github -- ${PKG_PHP_CHANGED_FILES[@]} ; fi + + - run: docker run --workdir="/mqdev" -v "`pwd`:/mqdev" --rm enqueue/dev:latest php -d memory_limit=1024M bin/phpstan analyse -l 1 -c phpstan.neon --error-format=github -- ${{ env.GIT_DIFF_FILTERED }} + if: env.GIT_DIFF_FILTERED code_style_check: name: Code style check @@ -41,9 +44,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set changed files - run: | - echo "PKG_PHP_CHANGED_FILES=$(./bin/git-find-changed-php-files.sh "origin/${{ github.base_ref }}..${{ github.head_ref }}")" + - uses: technote-space/get-diff-action@v4 + with: + PATTERNS: | + pkg/**/*.php - name: Get Composer Cache Directory id: composer-cache @@ -67,7 +71,9 @@ jobs: - run: php ./bin/fix-symfony-version.php "4.3.*" - run: composer install --no-progress - run: sed -i 's/525568/16777471/' vendor/kwn/php-rdkafka-stubs/stubs/constants.php - - run: if [ ! -z "${PKG_PHP_CHANGED_FILES}" ]; then ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection -- ${PKG_PHP_CHANGED_FILES[@]} ; fi + + - run: ./bin/php-cs-fixer fix --config=.php_cs.php --no-interaction --dry-run --diff -v --path-mode=intersection -- ${{ env.GIT_DIFF_FILTERED }} + if: env.GIT_DIFF_FILTERED tests: runs-on: ubuntu-latest