Skip to content
Merged
Show file tree
Hide file tree
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
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:

env:
fail-fast: true
PHPUNIT_FLAGS: "-v"
SYMFONY_PHPUNIT_DIR: "$HOME/symfony-bridge/.phpunit"
SYMFONY_REQUIRE: ">=3.4"

jobs:
coding-standards:
Expand Down Expand Up @@ -56,3 +59,97 @@ jobs:
-
name: "Run friendsofphp/php-cs-fixer"
run: "vendor/bin/php-cs-fixer fix --dry-run --diff"

test:
name: "PHP ${{ matrix.php-version }} + symfony/skeleton@${{ matrix.symfony-skeleton-stability }}"

runs-on: ubuntu-latest

services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_maker
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

continue-on-error: ${{ matrix.allow-failures }}

env:
SYMFONY_SKELETON_STABILITY: ${{ matrix.symfony-skeleton-stability }}

strategy:
matrix:
php-version:
- '7.1.33'
- '7.2.5'
- '7.3'
- '7.4'
symfony-skeleton-stability:
- 'stable'
allow-failures: [false]
include:
- php-version: '7.4'
symfony-skeleton-stability: 'dev'
allow-failures: true
- php-version: '8.0'
symfony-skeleton-stability: 'dev'
allow-failures: true

steps:
- name: "Checkout code"
uses: actions/checkout@v2.3.3

- name: "Start MySQL"
run: |
sudo /etc/init.d/mysql start

- name: "Verify MySQL connection from host"
run: |
sudo apt-get install -y mysql-client
mysql --host 127.0.0.1 --port 3306 -uroot -proot -e "SHOW DATABASES;"

- name: "Setup Database"
run: |
mysql --host 127.0.0.1 --port 3306 -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test_maker;"

- name: "Install PHP with extensions"
uses: shivammathur/setup-php@2.7.0
with:
coverage: "none"
php-version: ${{ matrix.php-version }}
tools: composer:v2

- name: "Add PHPUnit matcher"
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

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

- name: "Cache composer"
uses: actions/cache@v2.1.2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }}-symfony-skeleton-stability-${{ matrix.symfony-skeleton-stability }}-allow-failures-${{ matrix.allow-failures }}
restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer-

- name: "Require symfony/flex"
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-main

- if: matrix.php-version != '8.0'
run: composer update

- if: matrix.php-version == '8.0'
run: composer update --ignore-platform-reqs

- name: "Install PHPUnit"
run: vendor/bin/simple-phpunit install

- name: "PHPUnit version"
run: vendor/bin/simple-phpunit --version

- name: "Run tests"
run: vendor/bin/simple-phpunit ${{ env.PHPUNIT_FLAGS }}
39 changes: 0 additions & 39 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>
<php>
<ini name="error_reporting" value="-1" />
<env name="TEST_DATABASE_DSN" value="mysql://root:@127.0.0.1:3306/test_maker" />
<env name="TEST_DATABASE_DSN" value="mysql://root:root@127.0.0.1:3306/test_maker" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
</php>

Expand Down
8 changes: 4 additions & 4 deletions src/Test/MakerTestEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,15 @@ private function determineMissingDependencies(): array
private function getTargetSkeletonVersion(): string
{
if (null === $this->targetSkeletonVersion) {
$targetVersion = $_SERVER['MAKER_TEST_VERSION'] ?? 'stable';
$stability = $_SERVER['SYMFONY_SKELETON_STABILITY'] ?? 'stable';

if ('stable' === $targetVersion) {
if ('stable' === $stability) {
$this->targetSkeletonVersion = '';

return $this->targetSkeletonVersion;
}

switch ($targetVersion) {
switch ($stability) {
case 'stable-dev':
$httpClient = HttpClient::create();
$response = $httpClient->request('GET', 'https://symfony.com/versions.json');
Expand All @@ -469,7 +469,7 @@ private function getTargetSkeletonVersion(): string

break;
default:
throw new \InvalidArgumentException('Invalid target version');
throw new \InvalidArgumentException('Invalid stability');
}
}

Expand Down