Skip to content

Commit

Permalink
ci(github): phpunit.yml will also runs without optional packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru committed Jan 21, 2024
1 parent 8140128 commit bf3182d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
php-versions: ${{ steps.settings.outputs.php-versions }}
dependencies: ${{ steps.settings.outputs.dependencies }}
laravel-versions: ${{ steps.settings.outputs.laravel-versions }}
optional-packages: ${{ steps.settings.outputs.optional-packages }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -65,13 +66,17 @@ jobs:
# Laravel
echo "laravel-versions=$(jq '.require."laravel/framework" // "null" | split("|") | sort' -c composer.json)" >> $GITHUB_OUTPUT
# Optional packages
echo "optional-packages=$(jq '([((."extra"."lara-asp"."ci"."optional-packages" // ["null"]) | flatten | unique | sort | join(","))] + ["null"]) | unique' -r -c composer.json)" >> $GITHUB_OUTPUT
run:
# Only 28 characters are visible on UI :(
name: >-
P${{ matrix.php }}
${{ matrix.laravel != 'null' && format('L{0}', matrix.laravel) || '' }}
${{ matrix.dependencies == 'locked' && '🔒' || (matrix.dependencies == 'highest' && '🡹' || '🡻') }}
${{ startsWith(matrix.os, 'windows') && '🆆' || (startsWith(matrix.os, 'macos') && '🅼' || '🆄') }}
${{ matrix.optional != 'null' && '🪓' || '' }}
runs-on: ${{ matrix.os }}
needs:
Expand All @@ -82,6 +87,7 @@ jobs:
matrix:
php: ${{ fromJson(needs.settings.outputs.php-versions) }}
laravel: ${{ fromJson(needs.settings.outputs.laravel-versions) }}
optional: ${{ fromJson(needs.settings.outputs.optional-packages) }}
dependencies: ${{ fromJson(needs.settings.outputs.dependencies) }}
os: ${{ fromJson(inputs.runs-on) }}
exclude:
Expand Down Expand Up @@ -131,6 +137,19 @@ jobs:
composer require --no-interaction --no-progress --ansi --no-update "laravel/framework:${{ matrix.laravel }}"
composer remove --no-interaction --no-progress --ansi --no-update --dev larastan/larastan
- name: Remove optional packages
if: ${{ matrix.optional != 'null' }}
shell: bash
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
PACKAGES=$(echo '"${{ matrix.optional }}"' | jq 'split(",")' | jq -c -r '.[]')
while read -r PKG
do
composer remove --no-interaction --no-progress --ansi --no-update "${PKG}"
composer remove --no-interaction --no-progress --ansi --no-update --dev "${PKG}"
done <<< "${PACKAGES}"
- name: Install dependencies
uses: ramsey/composer-install@v2
with:
Expand Down
8 changes: 3 additions & 5 deletions packages/graphql/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@
"ext-fileinfo"
]
},
"optional-packages": {
"lastdragon-ru/lara-asp-graphql": [
"laravel/scout"
]
}
"optional-packages": [
"laravel/scout"
]
}
}
},
Expand Down

0 comments on commit bf3182d

Please sign in to comment.