Skip to content

Commit

Permalink
CI: simplify workflows with ramsey/composer-install
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk committed Dec 10, 2024
1 parent 18ffde8 commit 40cec88
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 144 deletions.
24 changes: 3 additions & 21 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,10 @@ jobs:
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: Get composer cache directory
id: composer-cache
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: "actions/[email protected]"
- name: "Install dependencies"
uses: "ramsey/[email protected]"
with:
path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"
dependency-versions: "${{ matrix.dependencies }}"

- name: "PhpBench"
run: "make phpbench"
24 changes: 3 additions & 21 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,10 @@ jobs:
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: Get composer cache directory
id: composer-cache
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: "actions/[email protected]"
- name: "Install dependencies"
uses: "ramsey/[email protected]"
with:
path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"
dependency-versions: "${{ matrix.dependencies }}"

- name: "Coding Standard"
run: "make phpcs PHPCS_FLAGS='-q --report=checkstyle | cs2pr'"
24 changes: 3 additions & 21 deletions .github/workflows/composer-json-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,10 @@ jobs:
ini-values: memory_limit=-1
tools: composer:v2, composer-normalize, composer-require-checker, composer-unused

- name: Get composer cache directory
id: composer-cache
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: "actions/[email protected]"
- name: "Install dependencies"
uses: "ramsey/[email protected]"
with:
path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"
dependency-versions: "${{ matrix.dependencies }}"

- name: "Validate composer.json"
run: "composer validate --strict"
Expand Down
24 changes: 3 additions & 21 deletions .github/workflows/mutation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,10 @@ jobs:
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: Get composer cache directory
id: composer-cache
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: "actions/[email protected]"
- name: "Install dependencies"
uses: "ramsey/[email protected]"
with:
path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"
dependency-versions: "${{ matrix.dependencies }}"

- name: "Infection"
run: "make infection PHPUNIT_FLAGS=--coverage-clover=coverage.xml INFECTION_FLAGS=--logger-github"
Expand Down
46 changes: 7 additions & 39 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
- "lowest"
- "highest"
- "locked"
- "development"
php-version:
- "8.2"
- "8.3"
Expand All @@ -36,32 +35,10 @@ jobs:
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: Get composer cache directory
id: composer-cache
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: "actions/[email protected]"
- name: "Install dependencies"
uses: "ramsey/[email protected]"
with:
path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"

- name: "Install development dependencies"
if: ${{ matrix.dependencies == 'development' }}
run: "composer config minimum-stability dev && composer update --no-interaction --no-progress"
dependency-versions: "${{ matrix.dependencies }}"

- name: "Tests"
run: "make phpunit"
Expand Down Expand Up @@ -92,20 +69,11 @@ jobs:
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: Get composer cache directory
id: composer-cache
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: "actions/[email protected]"
- name: "Install dependencies"
uses: "ramsey/[email protected]"
with:
path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress --ignore-platform-req=php"
dependency-versions: "${{ matrix.dependencies }}"
composer-options: " --ignore-platform-req=php"

- name: "Tests"
run: "make phpunit"
24 changes: 3 additions & 21 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,10 @@ jobs:
ini-values: memory_limit=-1
tools: composer:v2, cs2pr

- name: Get composer cache directory
id: composer-cache
run: echo "composer_cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: "Cache dependencies"
uses: "actions/[email protected]"
- name: "Install dependencies"
uses: "ramsey/[email protected]"
with:
path: ${{ steps.composer-cache.outputs.composer_cache_dir }}
key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

- name: "Install lowest dependencies"
if: ${{ matrix.dependencies == 'lowest' }}
run: "composer update --prefer-lowest --no-interaction --no-progress"

- name: "Install highest dependencies"
if: ${{ matrix.dependencies == 'highest' }}
run: "composer update --no-interaction --no-progress"

- name: "Install locked dependencies"
if: ${{ matrix.dependencies == 'locked' }}
run: "composer install --no-interaction --no-progress"
dependency-versions: "${{ matrix.dependencies }}"

- name: "PHPStan"
run: "make phpstan"

0 comments on commit 40cec88

Please sign in to comment.