diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 00000000..3a136785 --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,66 @@ +name: Continuous Integration + +on: + push: + # Avoid running tests on changes to documentation + paths-ignore: + - 'docs/**' + pull_request: + paths-ignore: + - 'docs/**' + +env: + COMPOSER_ARGS: '--no-progress' + +jobs: + build: + strategy: + matrix: + php_version: ['8.0'] + deps: ['--prefer-lowest --prefer-dist', ''] + include: + - code-coverage: 'yes' + php_version: '8.0' + deps: '' + runs-on: ubuntu-latest + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{matrix.php_version}} + + - name: Show PHP version + run: php -v + + - uses: actions/checkout@v4 + name: Checkout branch + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v4 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php_version }}-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php--${{matrix.php_version}}- + + - name: Install/update dependencies + run: composer update ${{matrix.deps}} $COMPOSER_ARGS + + - name: Run PHPUnit test suite + if: ${{ matrix.code-coverage != 'yes' }} + run: composer run-script test + + - name: Run PHPUnit test suite with coverage + if: ${{ matrix.code-coverage == 'yes' }} + run: composer run-script test-coverage + + - name: Upload coverage results to Coverall + if: ${{ matrix.code-coverage == 'yes' }} + uses: coverallsapp/github-action@v2 + + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e5270c36..00000000 --- a/.travis.yml +++ /dev/null @@ -1,58 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -env: - global: - - COMPOSER_ARGS="--no-interaction" - - XDEBUG_MODE=coverage - -matrix: - fast_finish: true - include: - - php: 7.4 - env: - - DEPS=lowest - - php: 7.4 - env: - - DEPS=latest - - php: 8.0 - env: - - DEPS=lowest - - php: 8.0 - env: - - DEPS=latest - - CS_CHECK=true - - TEST_COVERAGE=true - - php: 8.1 - env: - - DEPS=lowest - - php: 8.1 - env: - - DEPS=latest - -before_install: - - if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - -install: - - travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs - - if [[ $LEGACY_DEPS != '' ]]; then travis_retry composer update $COMPOSER_ARGS --with-dependencies $LEGACY_DEPS ; fi - - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS; fi - - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS; fi - - stty cols 120 && composer show - -before_script: - - mkdir -p ./build/logs - -script: - - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi - - composer cs-check - -after_success: - - composer upload-coverage - -notifications: - email: true -