From 80b701ef7ca58b5c4348ac1b88a344adf9346535 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 26 Aug 2024 16:41:12 +0200 Subject: [PATCH] Migrate the CI setup to GitHub Actions --- .gitattributes | 4 +- .github/workflows/ci.yml | 65 +++++++++++++++++++++++++++ .travis.yml | 96 ---------------------------------------- 3 files changed, 66 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.gitattributes b/.gitattributes index fb9157d..d480161 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,9 +3,7 @@ /tests export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.travis.yml export-ignore -.travis.yml export-ignore +/.github export-ignore .scrutinizer.yml export-ignore /phpunit.xml.dist export-ignore /README.md export-ignore - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ca39dbd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + push: + branches: + - master + - develop + pull_request: + workflow_dispatch: + +jobs: + check_composer: + name: Check composer.json + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + coverage: none + php-version: '8.3' + - run: composer validate --strict --no-check-lock + + tests: + name: "Tests on PHP ${{ matrix.php }}${{ matrix.name_suffix }}" + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + league_version: [ '' ] # Run jobs without changing the requirement from composer.json + name_suffix: [ '' ] + include: + - php: '5.6' + league_version: '5.1.*' + name_suffix: ' with League 5.1' + - php: '7.4' + league_version: '>=8.0.0 <=8.3.1' + name_suffix: ' with League 8.3.1' + + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + coverage: "none" + php-version: "${{ matrix.php }}" + ini-file: development + + - name: Update league requirement + if: matrix.league_version != '' + run: composer require league/oauth2-server:"$LEAGUE_VERSION" --no-update + + - name: Update permissions + run: | + chmod 600 tests/Stubs/private.key + chmod 600 tests/Stubs/public.key + + - name: Install dependencies + run: composer update --ansi --no-progress --prefer-dist --no-interaction + + - name: Run tests + run: php -d error_reporting="E_ALL & ~E_USER_DEPRECATED" vendor/bin/phpunit -v --colors=always --coverage-clover=coverage.clover + + - name: Upload coverage + run: 'wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 436100e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,96 +0,0 @@ -language: php - -dist: xenial -sudo: false - -cache: - directories: - - vendor - -env: - global: - XDEBUG_MODE=coverage - -matrix: - include: - - php: 5.6 - env: LEAGUE_VERSION=5.1.* JWT_VERSION=3.4.* - - php: 5.6 - env: LEAGUE_VERSION=6.0.* JWT_VERSION=3.4.* - - php: 5.6 - env: LEAGUE_VERSION=6.1.* JWT_VERSION=3.4.* - - - php: 7.0 - env: LEAGUE_VERSION=5.1.* JWT_VERSION=3.4.* - - php: 7.0 - env: LEAGUE_VERSION=6.0.* JWT_VERSION=3.4.* - - php: 7.0 - env: LEAGUE_VERSION=6.1.* JWT_VERSION=3.4.* - - php: 7.0 - env: LEAGUE_VERSION=7.0.* JWT_VERSION=3.4.* - - - php: 7.1 - env: LEAGUE_VERSION=5.1.* JWT_VERSION=3.4.* - - php: 7.1 - env: LEAGUE_VERSION=6.0.* JWT_VERSION=3.4.* - - php: 7.1 - env: LEAGUE_VERSION=6.1.* JWT_VERSION=3.4.* - - php: 7.1 - env: LEAGUE_VERSION=7.0.* JWT_VERSION=3.4.* - - php: 7.1 - env: LEAGUE_VERSION=">=8.0.0 <=8.3.1" JWT_VERSION=3.4.* - - php: 7.1 - env: LEAGUE_VERSION=^8.3.2 JWT_VERSION=3.4.* - - - php: 7.2 - env: LEAGUE_VERSION=5.1.* JWT_VERSION=3.4.* - - php: 7.2 - env: LEAGUE_VERSION=6.0.* JWT_VERSION=3.4.* - - php: 7.2 - env: LEAGUE_VERSION=6.1.* JWT_VERSION=3.4.* - - php: 7.2 - env: LEAGUE_VERSION=7.0.* JWT_VERSION=3.4.* - - php: 7.2 - env: LEAGUE_VERSION=">=8.0.0 <=8.3.1" JWT_VERSION=3.4.* - - php: 7.2 - env: LEAGUE_VERSION=^8.3.2 JWT_VERSION=3.4.* - - - php: 7.3 - env: LEAGUE_VERSION=">=8.0.0 <=8.3.1" JWT_VERSION=3.4.* - - php: 7.3 - env: LEAGUE_VERSION=^8.3.2 JWT_VERSION=3.4.* - - - php: 7.4 - env: LEAGUE_VERSION=">=8.0.0 <=8.3.1" JWT_VERSION=3.4.* - - php: 7.4 - env: LEAGUE_VERSION=^8.3.2 JWT_VERSION=3.4.* - - php: 7.4 - env: LEAGUE_VERSION=">=8.0.0 <=8.3.1" JWT_VERSION=^4.0 - - php: 7.4 - env: LEAGUE_VERSION=^8.3.2 JWT_VERSION=^4.0 - - - php: 8.0 - env: LEAGUE_VERSION=">=8.0.0 <=8.3.1" JWT_VERSION=^4.0 - - php: 8.0 - env: LEAGUE_VERSION=^8.3.2 JWT_VERSION=^4.0 - -before_install: - - composer require league/oauth2-server:"$LEAGUE_VERSION" --prefer-source --no-update - - composer require lcobucci/jwt:$JWT_VERSION --prefer-source --no-update - - chmod 600 $TRAVIS_BUILD_DIR/tests/Stubs/private.key - - chmod 600 $TRAVIS_BUILD_DIR/tests/Stubs/public.key - -install: - - composer update --prefer-source --no-interaction - -script: - - php -d error_reporting="E_ALL & ~E_USER_DEPRECATED" vendor/bin/phpunit --coverage-clover=coverage.clover - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover - -branches: - only: - - master - - develop