Skip to content

Commit

Permalink
minor #88 Simplifying CI matrix (weaverryan)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the main branch.

Discussion
----------

Simplifying CI matrix

Same as: SymfonyCasts/reset-password-bundle#192

Commits
-------

69b31b9 Simplifying CI matrix
  • Loading branch information
weaverryan committed Nov 19, 2021
2 parents 5913e21 + 69b31b9 commit 55487a5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 213 deletions.
261 changes: 50 additions & 211 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,255 +1,94 @@
name: Verify Email Bundle
name: Bundle CI
on:
push:
branches: ['main']
pull_request:
schedule:
- cron: '0 */12 * * *'

jobs:
composer-validate:
name: Validate composer.json
static-analysis:
name: Static Analysis
runs-on: ubuntu-18.04

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

- name: Validate
run: composer validate --no-check-lock --strict
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "8.0"

php-cs-fixer:
name: Lint Bundle Source
runs-on: ubuntu-18.04

steps:
- name: Set PHP Version
run: sudo update-alternatives --set php /usr/bin/php7.4
- name: "Validate composer.json"
run: "composer validate --strict --no-check-lock"

- name: Checkout
uses: actions/checkout@v2.0.0
- name: "Composer install"
uses: "ramsey/composer-install@v1"
with:
composer-options: "--prefer-stable"
dependency-versions: 'highest'

- name: Install PHP-CS-Fixer
run: composer global require friendsofphp/php-cs-fixer --prefer-dist --no-progress

- name: Enforce coding standards
run: $HOME/.composer/vendor/bin/php-cs-fixer fix --config $GITHUB_WORKSPACE/.php-cs-fixer.dist.php --diff --dry-run

psalm:
name: Psalm Static Analysis
runs-on: ubuntu-18.04

steps:
- name: Set PHP Version
run: sudo update-alternatives --set php /usr/bin/php7.4

- name: Checkout
uses: actions/checkout@v2.0.0

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Analyze Source
- name: Running Pslam
run: vendor/bin/psalm -c $GITHUB_WORKSPACE/psalm.xml

stable-tests:
name: Symfony Stable
- name: Running php-cs-fixer
run: $HOME/.composer/vendor/bin/php-cs-fixer fix --config $GITHUB_WORKSPACE/.php-cs-fixer.dist.php --diff --dry-run

tests:
name: "Tests ${{ matrix.php-version }} ${{ matrix.dependency-versions }} deps ${{ matrix.dependency-versions }}"
runs-on: ubuntu-18.04

strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']
symfony-version: ['4.4.*', '5.3.*']
# normal, highest, non-dev installs
php-version: ['7.2', '7.3', '7.4', '8.0', '8.1']
composer-options: ['--prefer-stable']
dependency-versions: ['highest']
include:
# testing lowest PHP version with lowest dependencies
- php-version: '7.2.5'
dependency-versions: 'lowest'
composer-options: '--prefer-lowest'

# testing dev versions with highest PHP
- php-version: '8.0'
dependency-versions: 'highest'
composer-options: '' # allow dev deps

steps:
- name: Set PHP Version
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }}

- name: Get PHP Version
run: |
ver=$(php -v | grep -oP '(?<=PHP )\d.\d')
echo "::set-output name=version::$ver"
id: php-ver
- name: "Checkout code"
uses: "actions/checkout@v2"

- name: Using PHP Version from matrix
run: |
echo "Runner is not using PHP Version defined in the php-versions matrix."
php -v
exit 1
if: steps.php-ver.outputs.version != matrix.php-versions

- name: Checkout
uses: actions/checkout@v2.0.0
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"

- name: Install Global Dependencies
run: |
composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-main
- name: Install dependencies
run: |
composer config minimum-stability stable
composer update --prefer-dist --no-progress
env:
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}

- name: Unit Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit
if: always()

- name: Functional Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional
if: always()

- name: Integration Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration
if: always()

- name: Acceptance Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite acceptance
if: always()

dev-54-tests:
name: Symfony 5.4
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
php-versions: ['8.0']
symfony-version: ['5.4.*', '6.0.*']

steps:
- name: Set PHP Version
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }}

- name: Get PHP Version
run: |
ver=$(php -v | grep -oP '(?<=PHP )\d.\d')
echo "::set-output name=version::$ver"
id: php-ver

- name: Using PHP Version from matrix
run: |
echo "Runner is not using PHP Version defined in the php-versions matrix."
php -v
exit 1
if: steps.php-ver.outputs.version != matrix.php-versions

- name: Checkout
uses: actions/checkout@v2.0.0

- name: Install dependencies
run: |
composer config minimum-stability beta
composer update --prefer-dist --no-progress
- name: Unit Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit
if: always()

- name: Functional Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional
if: always()

- name: Integration Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration
if: always()

- name: Acceptance Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite acceptance
if: always()

dev-main-tests:
name: Symfony 5.x
runs-on: ubuntu-18.04

strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']

steps:
- name: Set PHP Version
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }}

- name: Get PHP Version
run: |
ver=$(php -v | grep -oP '(?<=PHP )\d.\d')
echo "::set-output name=version::$ver"
id: php-ver

- name: Using PHP Version from matrix
run: |
echo "Runner is not using PHP Version defined in the php-versions matrix."
php -v
exit 1
if: steps.php-ver.outputs.version != matrix.php-versions

- name: Checkout
uses: actions/checkout@v2.0.0

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Unit Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit
if: always()

- name: Functional Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional
if: always()

- name: Integration Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration
if: always()

- name: Acceptance Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite acceptance
if: always()

lowest-version-tests:
name: Lowest dependencies
runs-on: ubuntu-18.04

strategy:
fail-fast: false
matrix:
php-versions: ['7.3', '7.4', '8.0']

steps:
- name: Set PHP Version
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-versions }}

- name: Get PHP Version
run: |
ver=$(php -v | grep -oP '(?<=PHP )\d.\d')
echo "::set-output name=version::$ver"
id: php-ver

- name: Using PHP Version from matrix
run: |
echo "Runner is not using PHP Version defined in the php-versions matrix."
php -v
exit 1
if: steps.php-ver.outputs.version != matrix.php-versions

- name: Checkout
uses: actions/checkout@v2.0.0

- name: Install dependencies
run: composer update --prefer-lowest --prefer-dist --no-progress
- name: "Composer install"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependency-versions }}"
composer-options: "--prefer-dist --no-progress"

- name: Unit Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite unit
if: always()

- name: Functional Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite functional
if: always()

- name: Integration Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite integration
if: always()

- name: Acceptance Tests
run: vendor/bin/simple-phpunit -c $GITHUB_WORKSPACE/phpunit.xml.dist --testsuite acceptance
if: always()
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
"require-dev": {
"doctrine/orm": "^2.7",
"doctrine/persistence": "^2.0",
"friendsofphp/php-cs-fixer": "^3.0",
"symfony/framework-bundle": "^4.4 | ^5.0 | ^6.0",
"symfony/phpunit-bridge": "^5.0",
"symfony/phpunit-bridge": "^5.0 | ^6.0",
"vimeo/psalm": "^4.3"
},
"conflict": {
Expand Down

0 comments on commit 55487a5

Please sign in to comment.