Merge pull request #36288 from PrestaShop/dependabot/npm_and_yarn/tes… #64
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: Symfony Console | |
on: | |
push: | |
pull_request: | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
symfony-console: | |
strategy: | |
matrix: | |
app-id: [ admin, admin-api, front ] | |
fail-fast: false | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
name: Symfony Console | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.1 | |
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer Directory | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Composer Install | |
run: COMPOSER_PROCESS_TIMEOUT=600 composer install --ansi --prefer-dist --no-interaction --no-progress | |
- name: Check bin/console can run without shop install and cache clear without app ID (only for admin job since it is the default value) | |
if: matrix.app-id == 'admin' | |
run: | | |
./bin/console | |
./bin/console cache:clear --env=dev | |
./bin/console cache:clear --env=prod | |
./bin/console cache:clear --env=dev --no-warmup | |
./bin/console cache:clear --env=prod --no-warmup | |
- name: Check bin/console can run without shop install and cache clear for application ${{ matrix.app-id }} | |
run: | | |
./bin/console --app-id=${{ matrix.app-id }} | |
./bin/console cache:clear --env=dev --app-id=${{ matrix.app-id }} | |
./bin/console cache:clear --env=prod --app-id=${{ matrix.app-id }} | |
./bin/console cache:clear --env=dev --no-warmup --app-id=${{ matrix.app-id }} | |
./bin/console cache:clear --env=prod --no-warmup --app-id=${{ matrix.app-id }} | |
- name: Check app listeners for OAuth API | |
if: matrix.app-id == 'admin-api' | |
run: | | |
apiListeners=$(./bin/console debug:event-dispatcher kernel.request --app-id=admin-api | grep 'PrestaShopBundle\\EventListener\\API' | wc -l) | |
adminListeners=$(./bin/console debug:event-dispatcher kernel.request --app-id=admin-api | grep 'PrestaShopBundle\\EventListener\\Admin' | wc -l) | |
echo $apiListeners API listeners detected | |
echo $adminListeners Admin listeners detected | |
if [ $adminListeners -ne 0 ]; then | |
echo No admin listeners should be present | |
exit 1 | |
fi | |
if [ $apiListeners -eq 0 ]; then | |
echo No API listeners detected | |
exit 1 | |
fi | |
- name: Check app listeners for Admin | |
if: matrix.app-id == 'admin' | |
run: | | |
apiListeners=$(./bin/console debug:event-dispatcher kernel.request --app-id=admin | grep 'PrestaShopBundle\\EventListener\\API' | wc -l) | |
adminListeners=$(./bin/console debug:event-dispatcher kernel.request --app-id=admin | grep 'PrestaShopBundle\\EventListener\\Admin' | wc -l) | |
echo $apiListeners API listeners detected | |
echo $adminListeners Admin listeners detected | |
if [ $adminListeners -eq 0 ]; then | |
echo No admin listeners detected | |
exit 1 | |
fi | |
if [ $apiListeners -ne 0 ]; then | |
echo No API listeners should be present | |
exit 1 | |
fi | |
# Now install the shop | |
- name: Setup Environment | |
timeout-minutes: 15 | |
uses: ./.github/actions/setup-env | |
with: | |
PHP_VERSION: 8.1 | |
ENABLE_SSL: 'true' | |
INSTALL_AUTO: 'false' | |
- name: Setup Environment failure | |
uses: ./.github/actions/setup-env-export-logs | |
with: | |
DOCKER_PREFIX: prestashop | |
ARTIFACT_NAME: setup-symfony-console-${{ matrix.app-id }} | |
if: failure() | |
# Retest the console after shop install | |
- name: Check bin/console and cache:clear can run after shop install | |
run: | | |
docker ps | |
docker exec prestashop-prestashop-git-1 php ./bin/console --app-id=${{ matrix.app-id }} | |
docker exec prestashop-prestashop-git-1 php -d memory_limit=-1 ./bin/console cache:clear --env=dev --app-id=${{ matrix.app-id }} | |
docker exec prestashop-prestashop-git-1 php -d memory_limit=-1 ./bin/console cache:clear --env=prod --app-id=${{ matrix.app-id }} | |
docker exec prestashop-prestashop-git-1 php ./bin/console cache:clear --env=dev --no-warmup --app-id=${{ matrix.app-id }} | |
docker exec prestashop-prestashop-git-1 php ./bin/console cache:clear --env=prod --no-warmup --app-id=${{ matrix.app-id }} |