From 261a0dd23aef598e3d645fb9e646884adcbeca86 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Thu, 7 Sep 2023 07:46:39 +0900 Subject: [PATCH] Migrate CI from travis to GH action for 2.x (#1475) --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++ .github/workflows/code-style.yml | 25 ++++++++++++++++++++++ .travis.yml | 26 ----------------------- composer.json | 2 +- 4 files changed, 62 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/code-style.yml delete mode 100755 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..bb0f3d9ca --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: build + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + test: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: true + matrix: + operating-system: [ ubuntu-latest ] + php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + dependencies: [ 'lowest', 'highest' ] + + name: PHP ${{ matrix.php }} on ${{ matrix.operating-system }} with ${{ matrix.dependencies }} dependencies + + steps: + - uses: actions/checkout@v2 + name: Checkout repository + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + + - name: Composer install + uses: ramsey/composer-install@v2 + with: + dependency-versions: ${{ matrix.dependencies }} + composer-options: "${{ matrix.composer-options }}" + + - name: PHPUnit Tests + run: bin/phpunit --configuration phpunit.xml.dist diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml new file mode 100644 index 000000000..1e5854323 --- /dev/null +++ b/.github/workflows/code-style.yml @@ -0,0 +1,25 @@ +name: code-style + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + php-cs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + name: Checkout repository + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + + - uses: ramsey/composer-install@v2 + with: + dependency-versions: 'highest' + + - name: Check Code Style + run: ./bin/phpcs -p --extensions=php --standard=PSR2 --error-severity=1 --warning-severity=0 ./src ./tests; diff --git a/.travis.yml b/.travis.yml deleted file mode 100755 index 6eb1318ab..000000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -php: - - 7.2 - - 7.3 - - 7.4 - - nightly - -env: - global: - - PHPUNIT=1 - -matrix: - fast_finish: true - - include: - - php: 7.4 - env: PHPCS=1 PHPUNIT=0 - -before_script: - - composer self-update - - composer update --prefer-dist --no-interaction - -script: - - sh -c "if [ '$PHPUNIT' = '1' ]; then ./bin/phpunit; fi" - - sh -c "if [ '$PHPCS' = '1' ]; then ./bin/phpcs -p --extensions=php --standard=PSR2 --error-severity=1 --warning-severity=0 ./src ./tests; fi" diff --git a/composer.json b/composer.json index b28fa6e7d..f6d22dd23 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ }, "require-dev": { "squizlabs/php_codesniffer": ">=2.7", - "phpunit/phpunit": "^8 || ^9" + "phpunit/phpunit": "^8.5.21 || ^9" }, "autoload-dev": { "psr-4": {