瀏覽代碼

Merge branch '1.10'

Jordi Boggiano 5 年之前
父節點
當前提交
1dd78c0163
共有 6 個文件被更改,包括 198 次插入151 次删除
  1. 48 13
      .github/workflows/continuous-integration.yml
  2. 36 0
      .github/workflows/lint.yml
  3. 56 0
      .github/workflows/phpstan.yml
  4. 58 0
      .github/workflows/release.yml
  5. 0 96
      .travis.yml
  6. 0 42
      appveyor.yml

+ 48 - 13
.github/workflows/continuous-integration.yml

@@ -1,19 +1,23 @@
-# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
-
 name: "Continuous Integration"
 
 on:
-  - "pull_request"
+  push:
+    paths-ignore:
+      - 'doc/**'
+  pull_request:
+    paths-ignore:
+      - 'doc/**'
 
 env:
-  COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist --optimize-autoloader"
+  COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
   SYMFONY_PHPUNIT_VERSION: ""
 
 jobs:
   tests:
-    name: "Tests"
+    name: "CI"
 
-    runs-on: "ubuntu-latest"
+    runs-on: ${{ matrix.os }}
+    continue-on-error: ${{ matrix.experimental }}
 
     strategy:
       matrix:
@@ -27,10 +31,34 @@ jobs:
           - "7.2"
           - "7.3"
           - "7.4"
-
-        dependencies:
-          - "locked"
-          - "highest"
+        dependencies: [locked]
+        os: [ubuntu-latest]
+        experimental: [false]
+        include:
+          - php-version: 5.3
+            dependencies: highest
+            os: ubuntu-latest
+            experimental: false
+          - php-version: 5.3
+            dependencies: lowest
+            os: ubuntu-latest
+            experimental: false
+          - php-version: 7.4
+            dependencies: highest
+            os: ubuntu-latest
+            experimental: true # TODO fix build errors there if possible
+          - php-version: 7.4
+            os: windows-latest
+            dependencies: locked
+            experimental: false
+          - php-version: 7.4
+            os: macos-latest
+            dependencies: locked
+            experimental: false
+          - php-version: 8.0
+            dependencies: highest
+            os: ubuntu-latest
+            experimental: true
 
     steps:
       - name: "Checkout"
@@ -40,6 +68,7 @@ jobs:
         uses: "shivammathur/setup-php@v2"
         with:
           coverage: "none"
+          extensions: "intl"
           ini-values: "memory_limit=-1"
           php-version: "${{ matrix.php-version }}"
 
@@ -56,16 +85,22 @@ jobs:
 
       - name: "Install highest dependencies from composer.json using composer binary provided by system"
         if: "matrix.dependencies == 'highest'"
-        run: "composer update ${{ env.COMPOSER_FLAGS }}"
+        run: "composer config platform --unset && composer update ${{ env.COMPOSER_FLAGS }}"
+
+      - name: "Install lowest dependencies from composer.json using composer binary provided by system"
+        if: "matrix.dependencies == 'lowest'"
+        run: "composer update ${{ env.COMPOSER_FLAGS }} --prefer-lowest"
 
       - name: "Install dependencies from composer.lock using composer binary provided by system"
         if: "matrix.dependencies == 'locked'"
         run: "composer install ${{ env.COMPOSER_FLAGS }}"
 
-      - name: "Install dependencies from composer.lock using composer binary from source"
-        if: "matrix.dependencies == 'locked'"
+      - name: "Run install again using composer binary from source"
         run: "bin/composer install ${{ env.COMPOSER_FLAGS }}"
 
+      - name: "Validate composer.json"
+        run: "bin/composer validate"
+
       - name: "Prepare git environment"
         run: "git config --global user.name composer && git config --global user.email composer@example.com"
 

+ 36 - 0
.github/workflows/lint.yml

@@ -0,0 +1,36 @@
+name: "PHP Lint"
+
+on:
+  push:
+    paths-ignore:
+      - 'doc/**'
+  pull_request:
+    paths-ignore:
+      - 'doc/**'
+
+jobs:
+  tests:
+    name: "Lint"
+
+    runs-on: ubuntu-latest
+
+    strategy:
+      matrix:
+        php-version:
+          - "5.3"
+          - "7.4"
+
+    steps:
+      - name: "Checkout"
+        uses: "actions/checkout@v2"
+
+      - name: "Install PHP"
+        uses: "shivammathur/setup-php@v2"
+        with:
+          coverage: "none"
+          extensions: "intl"
+          ini-values: "memory_limit=-1"
+          php-version: "${{ matrix.php-version }}"
+
+      - name: "Lint PHP files"
+        run: "find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f"

+ 56 - 0
.github/workflows/phpstan.yml

@@ -0,0 +1,56 @@
+name: "PHPStan"
+
+on:
+  push:
+    paths-ignore:
+      - 'doc/**'
+  pull_request:
+    paths-ignore:
+      - 'doc/**'
+
+env:
+  COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
+  SYMFONY_PHPUNIT_VERSION: ""
+
+jobs:
+  tests:
+    name: "PHPStan"
+
+    runs-on: ubuntu-latest
+
+    strategy:
+      matrix:
+        php-version:
+          - "7.4"
+
+    steps:
+      - name: "Checkout"
+        uses: "actions/checkout@v2"
+
+      - name: "Install PHP"
+        uses: "shivammathur/setup-php@v2"
+        with:
+          coverage: "none"
+          extensions: "intl"
+          ini-values: "memory_limit=-1"
+          php-version: "${{ matrix.php-version }}"
+
+      - name: "Determine composer cache directory"
+        id: "determine-composer-cache-directory"
+        run: "echo \"::set-output name=directory::$(composer config cache-dir)\""
+
+      - name: "Cache dependencies installed with composer"
+        uses: "actions/cache@v1"
+        with:
+          path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
+          key: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}-${{ hashFiles('**/composer.lock') }}"
+          restore-keys: "php-${{ matrix.php-version }}-symfony-php-unit-version-${{ env.SYMFONY_PHPUNIT_VERSION }}"
+
+      - name: "Install dependencies from composer.lock using composer binary provided by system"
+        run: "composer install ${{ env.COMPOSER_FLAGS }}"
+
+      - name: Run PHPStan
+        run: |
+          bin/composer require --dev phpstan/phpstan:^0.12 phpunit/phpunit:^7.5 --no-update
+          bin/composer update phpstan/* phpunit/* sebastian/* --with-all-dependencies
+          vendor/bin/phpstan analyse --configuration=phpstan/config.neon

+ 58 - 0
.github/workflows/release.yml

@@ -0,0 +1,58 @@
+name: "Release"
+
+on:
+  push:
+    tags:
+      - "*"
+
+env:
+  COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
+
+jobs:
+  build:
+    name: Upload Release Asset
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v2
+
+      - name: "Install PHP"
+        uses: "shivammathur/setup-php@v2"
+        with:
+          coverage: "none"
+          extensions: "intl"
+          ini-values: "memory_limit=-1"
+          php-version: "7.4"
+
+      - name: "Install dependencies from composer.lock using composer binary provided by system"
+        run: "composer install ${{ env.COMPOSER_FLAGS }}"
+
+      - name: "Run install again using composer binary from source"
+        run: "bin/composer install ${{ env.COMPOSER_FLAGS }}"
+
+      - name: "Validate composer.json"
+        run: "bin/composer validate"
+
+      - name: Build phar file
+        run: "php -d phar.readonly=0 bin/compile"
+
+      - name: Create release
+        id: create_release
+        uses: actions/create-release@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          tag_name: ${{ github.ref }}
+          release_name: ${{ github.ref }}
+          draft: true
+          body: TODO
+
+      - name: Upload phar
+        uses: actions/upload-release-asset@v1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          upload_url: ${{ steps.create_release.outputs.upload_url }}
+          asset_path: ./composer.phar
+          asset_name: composer.phar
+          asset_content_type: application/octet-stream

+ 0 - 96
.travis.yml

@@ -1,96 +0,0 @@
-language: php
-
-dist: bionic
-
-git:
-  depth: 5
-
-cache:
-  directories:
-    - $HOME/.composer/cache
-
-matrix:
-  include:
-    - php: 5.3
-      dist: precise
-      env:
-        - PHP_LINT=1
-    - php: 5.4
-      dist: trusty
-    - php: 5.5
-      dist: trusty
-    - php: 5.6
-      dist: xenial
-    - php: 7.0
-      dist: xenial
-    - php: 7.1
-      dist: xenial
-    - php: 7.2
-      dist: xenial
-    - php: 7.3
-      dist: xenial
-    # Regular 7.4 build with locked deps
-    - php: 7.4
-      env:
-        - SYMFONY_PHPUNIT_VERSION=7.5
-    # High deps check
-    - php: 7.4
-      env:
-        - deps=high
-        - SYMFONY_PHPUNIT_VERSION=7.5
-    # PHPStan checks
-    - php: 7.4
-      env:
-        - deps=high
-        - PHPSTAN=1
-        - SYMFONY_PHPUNIT_VERSION=7.5
-    - php: nightly
-  fast_finish: true
-  allow_failures:
-    - php: nightly
-
-before_install:
-  # disable Xdebug if available
-  - phpenv config-rm xdebug.ini || echo "xdebug not available"
-  # disable default memory limit
-  - export INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
-  - echo memory_limit = -1 >> $INI
-  - composer validate
-
-install:
-  # flags to pass to install
-  - flags="--ansi --prefer-dist --no-interaction --optimize-autoloader --no-progress"
-  # update deps to latest in case of high deps build
-  - if [ "$deps" == "high" ]; then composer config platform.php 7.4.0; composer update $flags; fi
-  # install dependencies using system provided composer binary
-  - composer install $flags
-  # install dependencies using composer from source
-  - bin/composer install $flags
-
-before_script:
-  # make sure git tests do not complain about user/email not being set
-  - git config --global user.name travis-ci
-  - git config --global user.email travis@example.com
-
-script:
-  - if [[ "$PHP_LINT" == "1" ]]; then find src/ -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f; fi
-  - if [[ $PHPSTAN == "1" ]]; then
-      bin/composer require --dev phpstan/phpstan:^0.12 phpunit/phpunit:^7.5 --no-update &&
-      bin/composer update phpstan/* phpunit/* sebastian/* --with-all-dependencies &&
-      vendor/bin/phpstan analyse --configuration=phpstan/config.neon;
-    else
-      vendor/bin/simple-phpunit;
-    fi
-
-before_deploy:
-  - php -d phar.readonly=0 bin/compile
-
-deploy:
-  provider: releases
-  api_key: $GITHUB_TOKEN
-  file: composer.phar
-  skip_cleanup: true
-  on:
-    tags: true
-    repo: composer/composer
-    php:  '7.3'

+ 0 - 42
appveyor.yml

@@ -1,42 +0,0 @@
-build: false
-clone_depth: 5
-
-environment:
-  # This sets the PHP version (from Chocolatey)
-  PHPCI_CHOCO_VERSION: 7.3.14
-  PHPCI_CACHE: C:\tools\phpci
-  PHPCI_PHP: C:\tools\phpci\php
-  PHPCI_COMPOSER: C:\tools\phpci\composer
-
-cache:
-  - '%PHPCI_CACHE% -> appveyor.yml'
-
-init:
-  - SET PATH=%PHPCI_PHP%;%PHPCI_COMPOSER%;%PATH%
-  - SET COMPOSER_HOME=%PHPCI_COMPOSER%\home
-  - SET COMPOSER_CACHE_DIR=%PHPCI_COMPOSER%\cache
-  - SET COMPOSER_NO_INTERACTION=1
-  - SET PHP=0
-  - SET ANSICON=121x90 (121x90)
-
-install:
-  - IF EXIST %PHPCI_CACHE% (SET PHP=1)
-  - IF %PHP%==0 cinst php -i -y --version %PHPCI_CHOCO_VERSION%  --params "/InstallDir:%PHPCI_PHP%"
-  - IF %PHP%==0 cinst composer -i -y --ia "/DEV=%PHPCI_COMPOSER%"
-  - php -v
-  - IF %PHP%==0 (composer --version) ELSE (composer self-update)
-  - IF %PHP%==0 cd %PHPCI_PHP%
-  - IF %PHP%==0 copy php.ini-production php.ini /Y
-  - IF %PHP%==0 echo date.timezone="UTC" >> php.ini
-  - IF %PHP%==0 echo extension_dir=ext >> php.ini
-  - IF %PHP%==0 echo extension=php_openssl.dll >> php.ini
-  - IF %PHP%==0 echo extension=php_mbstring.dll >> php.ini
-  - IF %PHP%==0 echo extension=php_fileinfo.dll >> php.ini
-  - IF %PHP%==0 echo extension=php_intl.dll >> php.ini
-  - IF %PHP%==0 echo extension=php_curl.dll >> php.ini
-  - cd %APPVEYOR_BUILD_FOLDER%
-  - composer install --prefer-dist --no-progress
-
-test_script:
-  - cd %APPVEYOR_BUILD_FOLDER%
-  - vendor\bin\simple-phpunit --colors=always