Packages #1215
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Packages | |
on: | |
push: ~ | |
pull_request: ~ | |
# push: | |
# branches-ignore: | |
# - 'dependabot/**' | |
# paths: | |
# - "src/Monofony/Bridge/**" | |
# - "src/Monofony/Bundle/**" | |
# - "src/Monofony/Component/**" | |
# - "src/Monofony/Contracts/**" | |
# - "src/Monofony/Pack/**" | |
# pull_request: | |
# paths: | |
# - "src/Monofony/Bridge/**" | |
# - "src/Monofony/Bundle/**" | |
# - "src/Monofony/Component/**" | |
# - "src/Monofony/Contracts/**" | |
# - "src/Monofony/Pack/**" | |
release: | |
types: [created] | |
schedule: | |
- | |
cron: "0 1 * * 6" # Run at 1am every Saturday | |
workflow_dispatch: ~ | |
jobs: | |
list: | |
runs-on: ubuntu-latest | |
name: "Create a list of packages" | |
steps: | |
- | |
uses: actions/checkout@v2 | |
- | |
name: "Provide the list" | |
id: create-list | |
run: echo "::set-output name=packages::$(find src/Monofony -mindepth 3 -maxdepth 3 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/Monofony\///g' | sort | jq --raw-input . | jq --slurp . | jq -c .)" | |
outputs: | |
packages: "${{ steps.create-list.outputs.packages }}" | |
test: | |
needs: list | |
runs-on: ubuntu-latest | |
name: "${{ matrix.package }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}" | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ["8.2"] | |
symfony: ["^6.4", "^7.1"] | |
package: "${{ fromJson(needs.list.outputs.packages) }}" | |
steps: | |
- | |
uses: actions/checkout@v2 | |
- | |
name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ matrix.php }}" | |
coverage: none | |
- | |
name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- | |
name: Cache Composer | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer-${{ hashFiles(format('src/Monofony/{0}/composer.json', matrix.package)) }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer- | |
${{ runner.os }}-php-${{ matrix.php }}-package- | |
- | |
name: Restrict Symfony version | |
if: matrix.symfony != '' | |
run: | | |
composer global config --no-plugins allow-plugins.symfony/flex true | |
composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^2.0" | |
composer config extra.symfony.require "${{ matrix.symfony }}" | |
working-directory: "src/Monofony/${{ matrix.package }}" | |
- | |
name: Validate composer.json | |
if: ${{ true != contains( matrix.package, 'Pack' ) }} | |
run: composer validate --ansi --strict | |
working-directory: "src/Monofony/${{ matrix.package }}" | |
- | |
name: Install dependencies | |
run: composer install --ansi --no-interaction | |
env: | |
COMPOSER_ROOT_VERSION: dev-master | |
working-directory: "src/Monofony/${{ matrix.package }}" | |
- | |
name: Check phpstan.neon existence | |
id: check_phpstan_files | |
uses: andstor/file-existence-action@v1 | |
with: | |
files: "src/Monofony/${{ matrix.package }}/phpstan.neon" | |
- | |
name: Run PHPStan | |
if: steps.check_phpstan_files.outputs.files_exists == 'true' | |
run: make test-package-phpstan path=src/Monofony/${{ matrix.package }} |