Symfony tests #5
Workflow file for this run
This file contains hidden or 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: marvin255_value_object_bundle | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| lint_and_test: | |
| name: Value objects (PHP ${{ matrix.php-versions }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| php-versions: ['8.3', '8.4'] | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| - name: Check PHP Version | |
| run: php -v | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| if: steps.composer-cache.outputs.cache-hit != 'true' | |
| run: composer install --prefer-dist --no-progress --no-suggest | |
| - name: Run linters | |
| run: composer run-script linter | |
| - name: Run test suite | |
| run: composer run-script test | |
| - name: Run infection testing | |
| run: composer run-script infection | |
| symfony_installation: | |
| name: Test installation to Symfony (PHP ${{ matrix.php-versions }}, Symfony ${{ matrix.symfony-versions }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-versions: ['8.3', '8.4'] | |
| symfony-versions: ['6.4', '7.1', '7.2'] | |
| env: | |
| SYMFONY_FOLDER: symfony_app | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Setup PHP with composer and extensions | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-versions }} | |
| extensions: mbstring, dom, fileinfo, mysql, curl | |
| - name: Cache Symfony app | |
| id: symfony-app-cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: symfony_app_tmp | |
| key: ${{ runner.os }}-symfony-${{ matrix.symfony-versions }}-${{ matrix.php-versions }} | |
| - name: Install Symfony app | |
| if: steps.symfony-app-cache.outputs.cache-hit != 'true' | |
| run: | | |
| composer create-project symfony/skeleton:"${{ matrix.symfony-versions }}.*" symfony_app_tmp | |
| cd symfony_app_tmp | |
| composer require webapp | |
| - name: Prepare fresh Symfony app | |
| run: | | |
| cp -r symfony_app_tmp $SYMFONY_FOLDER | |
| - name: Select branch to install module | |
| id: extract_branch | |
| run: | | |
| if [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then | |
| echo "::set-output name=branch::$(echo ${GITHUB_REF##*/})" | |
| elif [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then | |
| echo "::set-output name=branch::$(echo $GITHUB_HEAD_REF)" | |
| else | |
| echo "::set-output name=branch::INVALID_EVENT_BRANCH_UNKNOWN" | |
| fi | |
| - name: Set database settings | |
| run: | | |
| echo "APP_ENV=dev" > $SYMFONY_FOLDER/.env | |
| echo "APP_SECRET=test" >> $SYMFONY_FOLDER/.env | |
| echo "DATABASE_URL=mysql://test:test@127.0.0.1:3306/test?serverVersion=5.7" >> $SYMFONY_FOLDER/.env | |
| echo "MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0" >> $SYMFONY_FOLDER/.env | |
| - name: Install module | |
| run: | | |
| cd $SYMFONY_FOLDER | |
| composer req "marvin255/value-object-bundle:dev-${{ steps.extract_branch.outputs.branch }}" -W | |
| - name: Check that module is auto enabled | |
| run: | | |
| cat $SYMFONY_FOLDER/config/bundles.php | grep "Marvin255RandomStringGeneratorBundle" | |
| - name: Check that Doctrine works fine | |
| run: | | |
| cat $SYMFONY_FOLDER/bin/console doctrine:mapping:info --no-interaction |