Skip to content

Candidate/v4.x #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: v4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/php-functional-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: PHP Functional Tests

on:
push:
paths:
- '**workflows/php-functional-tests.yml'
- '**.php'
- '**phpunit.xml.dist'
- '**composer.json'
pull_request:
paths:
- '**workflows/php-functional-tests.yml'
- '**.php'
- '**phpunit.xml.dist'
- '**composer.json'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
unit-tests:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'skip tests') }}
strategy:
fail-fast: true
matrix:
php-ver: [ '8.0', '8.1', '8.2', '8.3' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-ver }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: 'none'
tools: cs2pr, composer:v2

- name: Adjust Composer dependencies
run: |
composer remove --dev --no-update "inpsyde/php-coding-standards"
composer remove --dev --no-update "vimeo/psalm"
composer require --dev --no-update "composer/composer:^2"

- name: Install dependencies
uses: ramsey/composer-install@v3

- name: Run functional tests
run: ./vendor/bin/phpunit --testsuite=functional --no-coverage
16 changes: 12 additions & 4 deletions .github/workflows/php-static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,25 @@ concurrency:
jobs:
lint-php:
uses: inpsyde/reusable-workflows/.github/workflows/lint-php.yml@main
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run lint only') || (github.event.inputs.jobs == 'Run all')) }}
strategy:
matrix:
php: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2"]
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run lint only')) }}
php: [ '8.0', '8.1', '8.2', '8.3' ]
with:
PHP_VERSION: ${{ matrix.php }}

coding-standards-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run PHPCS only')) }}
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run PHPCS only') || (github.event.inputs.jobs == 'Run all')) }}
uses: inpsyde/reusable-workflows/.github/workflows/coding-standards-php.yml@main
with:
PHP_VERSION: '8.0'

static-code-analysis-php:
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run all') || (github.event.inputs.jobs == 'Run Psalm only')) }}
if: ${{ (github.event_name != 'workflow_dispatch') || ((github.event.inputs.jobs == 'Run Psalm only') || (github.event.inputs.jobs == 'Run all')) }}
uses: inpsyde/reusable-workflows/.github/workflows/static-analysis-php.yml@main
strategy:
matrix:
php: [ '8.0', '8.1', '8.2', '8.3' ]
with:
PHP_VERSION: ${{ matrix.php }}
PSALM_ARGS: '--no-suggestions --report-show-info=false --find-unused-psalm-suppress --no-diff --no-cache --no-file-cache --long-progress'
29 changes: 8 additions & 21 deletions .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,52 +28,39 @@ jobs:
strategy:
fail-fast: false
matrix:
php-ver: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ]
composer-ver: [ '^1', '~2.0.0', '~2.1.0', '~2.2.0', '~2.3.0', '~2.4.0', '~2.5.0' ]
exclude:
- php-ver: '8.1'
composer-ver: '^1'
- php-ver: '8.1'
composer-ver: '~2.0.0'
- php-ver: '8.2'
composer-ver: '^1'
- php-ver: '8.2'
composer-ver: '~2.0.0'
- php-ver: '8.2'
composer-ver: '~2.1.0'
php-ver: [ '8.0', '8.1', '8.2', '8.3' ]
composer-ver: [ '2.3', '2.4', '2.5', '2.6', '2' ]

steps:
- name: Update "USE_COVERAGE" env var based on matrix
if: ${{ matrix.php-ver == '8.0' && matrix.deps-mode == 'highest' }}
run: echo "USE_COVERAGE=yes" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-ver }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
coverage: ${{ ((env.USE_COVERAGE == 'yes') && 'xdebug') || 'none' }}
tools: cs2pr
tools: cs2pr, composer:v${{ matrix.composer-ver }}

- name: Adjust Composer dependencies
run: |
composer remove --dev --no-update "inpsyde/php-coding-standards"
composer remove --dev --no-update "vimeo/psalm"
composer require --dev --no-update "composer/composer:${{ matrix.composer-ver }}"
composer require --dev --no-update "composer/composer:~${{ matrix.composer-ver }}.0"

- name: Install dependencies
uses: ramsey/composer-install@v2
uses: ramsey/composer-install@v3

- name: Run unit tests
run: |
./vendor/bin/phpunit --atleast-version 9 && ./vendor/bin/phpunit --migrate-configuration || echo 'Config does not need updates.'
./vendor/bin/phpunit --testsuite=unit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-html=coverage-report') || '--no-coverage' }}
run: ./vendor/bin/phpunit --testsuite=unit ${{ ((env.USE_COVERAGE == 'yes') && '--coverage-html=coverage-report') || '--no-coverage' }}

- name: Upload coverage report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ env.USE_COVERAGE == 'yes' }}
with:
name: coverage-report
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Inpsyde GmbH
Copyright (c) 2024 Syde GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
56 changes: 35 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Let's assume we have a website project having a `composer.json` that looks like
"require": {
"acme/foo": "^1",
"acme/bar": "^2",
"inpsyde/composer-assets-compiler": "^3"
"inpsyde/composer-assets-compiler": "^4"
},
"extra": {
"composer-asset-compiler": { "auto-run": true }
Expand Down Expand Up @@ -65,27 +65,41 @@ The example above is the simplest use case, but the plugin has many possible con

## Documentation

- [Introduction](docs/001-Introduction.md)
- [Compiling Assets](docs/002-Compiling_Assets.md)
- [Script](docs/003-Script.md)
- [Dependencies](docs/004-Dependencies.md)
- [Package Manager](docs/005-Package_Manager.md)
- [Pre-compilation](docs/006-Pre-compilation.md)
- [Hash and Lock](docs/007-Hash_and_Lock.md)
- [Execution Mode](docs/008-Execution_Mode.md)
- [Configuration File](docs/009-Configuration_File.md)
- [Packages Configuration in Root](docs/010-Packages_Configuration_in_Root.md)
- [Verbosity](docs/011-Verbosity.md)
- [Isolated Cache](docs/012-Isolated_Cache.md)
- [Parallel Assets Processing](docs/013-Parallel_Assets_Processing.md)
- [Configuration Cheat-Sheet](docs/014-Configuration-Cheat-Sheet.md)
- [CLI Parameters](docs/015-CLI-Parameters.md)
- [Environment Variables](docs/016-Environment_Variables.md)
- [Why bother](./docs/001-Why_Bother.md)
- [Compiling Assets](./docs/002-Compiling_Assets.md)
- [Script](./docs/003-Script.md)
- [Dependencies](./docs/004-Dependencies.md)
- [Package Manager](./docs/005-Package_Manager.md)
- [Pre-compilation](./docs/006-Pre-compilation.md)
- [Hash and Lock](./docs/007-Hash_Lock.md)
- [Execution Mode](./docs/008-Execution_Mode.md)
- [Configuration File](./docs/009-Configuration_File.md)
- [Packages Configuration in Root](./docs/010-Packages_Configuration_Root.md)
- [Verbosity](./docs/011-Verbosity.md)
- [Isolated Cache](./docs/012-Isolated_Cache.md)
- [Parallel Assets Processing](./docs/013-Parallel_Assets_Processing.md)
- [Configuration Cheat-Sheet](./docs/014-Configuration_Cheat-Sheet.md)
- [CLI Commands and Parameters](./docs/015-CLI_Commands_Parameters.md)
- [Environment Variables](./docs/016-Environment_Variables.md)

## Requirements

- PHP 8.0+
- Composer 2.3+

When installed with "dev" dependencies, via Composer the following packages are directly required:

- `composer/composer` (MIT)
- `phpunit/phpunit` (BSD-3-Clause)
- `mockery/mockery` (BSD-3-Clause)
- `inpsyde/php-coding-standards` (MIT)
- `vimeo/psalm` (MIT)
- `mikey179/vfsstream` (BSD-3-Clause)

## License and Copyright

Copyright (c) 2022 [Inpsyde GmbH](https://inpsyde.com/en/).
## License and Copyright

_Composer Asset Compiler_ code is licensed under [MIT license](./LICENSE).
_Composer Asset Compiler_ is a free software, and is released under the terms of the MIT license.
See [LICENSE](./LICENSE) for complete license.

The team at Inpsyde is engineering the Web since 2006.
The team at Syde is engineering the Web since 2006.
23 changes: 12 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"authors": [
{
"name": "Inpsyde GmbH",
"homepage": "https://inpsyde.com/",
"email": "hello@inpsyde.com",
"homepage": "https://syde.com/",
"email": "hello@syde.com",
"role": "Company"
},
{
Expand All @@ -18,9 +18,9 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">= 7.2 < 8.3",
"php": ">= 8.0 < 8.4",
"ext-json": "*",
"composer-plugin-api": "^1 || ^2"
"composer-plugin-api": "^2.3"
},
"autoload": {
"psr-4": {
Expand All @@ -33,12 +33,12 @@
}
},
"require-dev": {
"composer/composer": "^1.10.24 || ^2.5.5",
"phpunit/phpunit": "^8.5.33 || ^9.6.7",
"mockery/mockery": "^1.3.5 || ^1.4.4",
"inpsyde/php-coding-standards": "^1.0.0",
"vimeo/psalm": ">=4.30.0",
"mikey179/vfsstream": "^1.6.11"
"composer/composer": "^2.3",
"phpunit/phpunit": "^9.6.7",
"mockery/mockery": "^1.6.7",
"inpsyde/php-coding-standards": "^2.0.0-beta.3",
"vimeo/psalm": "^5.22.2",
"mikey179/vfsstream": "^v1.6.11"
},
"scripts": {
"cs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
Expand All @@ -56,7 +56,8 @@
"dev-master": "2.x-dev",
"dev-v1.x": "1.x-dev",
"dev-v2.x": "2.x-dev",
"dev-v3.x": "3.x-dev"
"dev-v3.x": "3.x-dev",
"dev-v4.x": "3.x-dev"
}
},
"config": {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/007-Hash_and_Lock.md → docs/007-Hash_Lock.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ composer compile-assets --ignore-lock=*
The hash of the package can also be calculated programmatically using the command:

```shell
composer assets-hash
composer asset-hash
```

That can be useful to generate the filename of the archive during pre-compilation, in case we want to use the `${hash}` placeholder.
Expand Down
12 changes: 1 addition & 11 deletions docs/008-Execution_Mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,4 @@ For example:
}
```

In the example above, `pre-compiled` configuration is the same regardless execution mode, whereas the `script` configuration is mode-specific.



## Deprecated "env"

In _Composer Assets Compiler_ < 3.0, the `"$mode"` property was called `"env"`.

That generated confusion because it has nothing to do with _environment_ variables nor with the `default-env` configuration. That's why it was replaced by `"$mode"` in _Composer Assets Compiler_ 3.

However, to facilitate migration for packages previously using a lower version, the `"env"` key is still supported in version 3, but support might be removed in future versions.
In the example above, `pre-compiled` configuration is the same regardless execution mode, whereas the `script` configuration is mode-specific.
4 changes: 2 additions & 2 deletions docs/011-Verbosity.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Composer options that control `verbosity` have multiple effects on _Composer Ass

| Composer flag | _npm_ | _Yarn_ |
|--------------------|------------|-------------|
| `-v` / `--verbose` | `-d` |
| `-vv` | `-dd` |
| `-v` / `--verbose` | `-d` | |
| `-vv` | `-dd` | |
| `-vvv` | `-ddd` | `--verbose` |
| `-q` / `-quite` | `--silent` | `--silent` |

Expand Down
19 changes: 16 additions & 3 deletions docs/015-CLI-Parameters.md → docs/015-CLI_Commands_Parameters.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: CLI parameters
title: CLI commands and parameters
nav_order: 16
---

# CLI parameters
# CLI commands and parameters


## Command: `compile-assets`
Expand All @@ -16,9 +16,22 @@ nav_order: 16



## Command: `assets-hash`
## Command: `asset-hash`

| Parameter | Description |
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `--mode=<mode>` | Sets the "execution mode" which might affect the hash of the assets. |
| `--no-dev` | Simulate auto-run on Composer installation/update with the `--no-dev` flag.<br />This causes the plugin to check for `$default-no-dev` as the default "mode". |



## Command: `assets-info`

| Parameter | Description |
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `... <asset>` | Variadic number of asset names to limit information to. Can not be used together with `--root`. |
| `--mode=<mode>` | Sets the "execution mode" which might affect the hash of the assets. |
| `--no-dev` | Simulate auto-run on Composer installation/update with the `--no-dev` flag.<br />This causes the plugin to check for `$default-no-dev` as the default "mode". |
| `--root` | Get information only for root package. Can not be used if any asset name is given as argument. |
| `--table` | Format output as table. |
| `--fields` | Comma-separated properties to print. |
4 changes: 2 additions & 2 deletions docs/016-Environment_Variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ nav_order: 17
| `GITHUB_API_USER` | Alternative to `GITHUB_USER_NAME`. |
| `GITHUB_ACTOR` | Alternative to `GITHUB_USER_NAME`. |
| `GITHUB_USER_TOKEN` | Set the GitHub Personal Access Token to be used for GitHub pre-compilation adapters. |
| `GITHUB_API_TOKEN` | Alternative to `GITHUB_USER_TOKEN`. |
| `GITHUB_TOKEN` | Alternative to `GITHUB_USER_TOKEN`. |
| `GITHUB_API_TOKEN` | Alternative to `GITHUB_USER_TOKEN`. |
| `GITHUB_TOKEN` | Alternative to `GITHUB_USER_TOKEN`. |
| `GITHUB_API_REPOSITORY` | Set the GitHub repository to be used for GitHub pre-compilation adapters. Alternative to `pre-compiled.config.repository` setting. |
| `GITHUB_REPOSITORY` | Alternative to `GITHUB_API_REPOSITORY`. |

Expand Down
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Let's assume we have a website project having a `composer.json` that looks like
"require": {
"acme/foo": "^1",
"acme/bar": "^2",
"inpsyde/composer-assets-compiler": "^3"
"inpsyde/composer-assets-compiler": "^4"
},
"extra": {
"composer-asset-compiler": { "auto-run": true }
Expand Down Expand Up @@ -65,19 +65,19 @@ The example above is the simplest use case, but the Composer Assets Compiler has

## Documentation

- [Why bother](./001-Why-Bother.md)
- [Why bother](./001-Why_Bother.md)
- [Compiling Assets](./002-Compiling_Assets.md)
- [Script](./003-Script.md)
- [Dependencies](./004-Dependencies.md)
- [Package Manager](./005-Package_Manager.md)
- [Pre-compilation](./006-Pre-compilation.md)
- [Hash and Lock](./007-Hash_and_Lock.md)
- [Hash and Lock](./007-Hash_Lock.md)
- [Execution Mode](./008-Execution_Mode.md)
- [Configuration File](./009-Configuration_File.md)
- [Packages Configuration in Root](./010-Packages_Configuration_in_Root.md)
- [Packages Configuration in Root](./010-Packages_Configuration_Root.md)
- [Verbosity](./011-Verbosity.md)
- [Isolated Cache](./012-Isolated_Cache.md)
- [Parallel Assets Processing](./013-Parallel_Assets_Processing.md)
- [Configuration Cheat-Sheet](./014-Configuration-Cheat-Sheet.md)
- [CLI Parameters](./015-CLI-Parameters.md)
- [Configuration Cheat-Sheet](./014-Configuration_Cheat-Sheet.md)
- [CLI Commands and Parameters](./015-CLI_Commands_Parameters.md)
- [Environment Variables](./016-Environment_Variables.md)
Loading