Skip to content

Updated Test Project #63

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

Merged
merged 1 commit into from
Dec 6, 2020
Merged
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
109 changes: 45 additions & 64 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,11 @@ jobs:
tests:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: symfony_test
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

strategy:
matrix:
php: [7.0, 7.1, 7.2, 7.3, 7.4, 8.0]
symfony: [3.4, 4, 5]
php: [7.1, 7.2, 7.3, 7.4, 8.0]
symfony: [3.4, 4.4, 5]
exclude:
- php: 7.3
symfony: 3.4
- php: 7.4
symfony: 3.4
- php: 8.0
symfony: 3.4
- php: 7.0
symfony: 4
- php: 7.0
symfony: 5
- php: 7.1
symfony: 5

Expand All @@ -46,66 +22,71 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pdo, mysql, sqlite
tools: composer:v2
extensions: ctype, iconv, intl, json, mbstring, pdo, pdo_sqlite
coverage: none

- name: Checkout Symfony 3.4 Sample
if: matrix.symfony == 3.4
uses: actions/checkout@v2
with:
repository: Naktibalda/codeception-symfony-tests
path: framework-tests
repository: Codeception/symfony-module-tests
submodules: recursive
ref: 3.4

- name: Checkout Symfony 4 Sample
if: matrix.symfony == 4
- name: Checkout Symfony 4.4 Sample
if: matrix.symfony == 4.4
uses: actions/checkout@v2
with:
repository: Codeception/symfony-demo
path: framework-tests
repository: Codeception/symfony-module-tests
submodules: recursive
ref: 4.4

- name: Checkout Symfony 5 Sample
if: matrix.symfony == 5
uses: actions/checkout@v2
with:
repository: Codeception/symfony-demo
path: framework-tests
ref: symfony5
repository: Codeception/symfony-module-tests
submodules: recursive
ref: main

- name: Validate composer.json and composer.lock
run: composer validate

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2.1.3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-

- name: Install Symfony Sample on PHP7
if: matrix.php < 8
run: composer update --no-dev --prefer-dist --no-interaction
working-directory: framework-tests
run: composer update --no-progress
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove --no-dev, --prefer-dist and --no-interaction ?

Copy link
Member Author

@TavoNiievez TavoNiievez Dec 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • no-dev: I want the latest versions of Codeception and its modules (which is included in the require-dev section in the composer.json files) to be used when running CI jobs.

  • --no-interaction: There will be no interaction anyway, the .lock files keep track of the installed recipes, it is very unlikely that any bundle will add a new recipe within a minor version and this also damages the continuous integration flow.

  • --prefer-dist: Well, this is already included in the composer.json files. In any case what the composer documentation says is 'This can speed up installs substantially on build servers and other use cases where you typically do not run updates of the vendors .' and i am intentionally running a composer update to update all dependencies to their latest version.

Here I also took into account how it is done in symfony/demo, but when analyzing each individual case, i came to the conclusion that the only thing I don't want is to see the progress of locking/downloading/installation in the logs.


- name: Install Symfony Sample on PHP8
if: matrix.php == 8.0
run: composer update --no-dev --prefer-dist --no-interaction --ignore-platform-req=php
working-directory: framework-tests
run: composer update --no-progress --ignore-platform-req=php

- name: Validate composer.json and composer.lock
run: composer validate
- name: Yarn install
uses: borales/actions-yarn@v2.3.0
with:
cmd: install

- name: Install dependencies
run: |
composer require "symfony/finder=~${{ matrix.symfony }}" --no-update --ignore-platform-reqs
composer require "symfony/yaml=~${{ matrix.symfony }}" --no-update --ignore-platform-reqs
composer require "symfony/console=~${{ matrix.symfony }}" --no-update --ignore-platform-reqs
composer require "symfony/event-dispatcher=~${{ matrix.symfony }}" --no-update --ignore-platform-reqs
composer require "symfony/css-selector=~${{ matrix.symfony }}" --no-update --ignore-platform-reqs
composer require "symfony/dom-crawler=~${{ matrix.symfony }}" --no-update --ignore-platform-reqs
composer require "symfony/browser-kit=~${{ matrix.symfony }}" --no-update --ignore-platform-reqs
composer install --prefer-dist --no-progress --no-interaction --no-suggest

- name: Database Symfony 3.4
if: matrix.symfony == 3.4
run: |
sed -i -e "s/%database_host%/127.0.0.1/g" app/config/config.yml
sed -i -e "s/%database_port%/3306/g" app/config/config.yml
sed -i -e "s/%database_name%/symfony_test/g" app/config/config.yml
sed -i -e "s/%database_user%/root/g" app/config/config.yml
sed -i -e "s/%database_password%//g" app/config/config.yml
php bin/console doctrine:schema:update --force -n
working-directory: framework-tests
- name: Yarn build
uses: borales/actions-yarn@v2.3.0
with:
cmd: run encore production

- name: Update database schema
run: php bin/console d:s:u -f

- name: Load Doctrine fixtures
run: php bin/console d:f:l -q

- name: Run test suite Symfony
run: php vendor/bin/codecept run functional -c framework-tests
run: php vendor/bin/codecept run Functional