From 899f20162b1d7cc0f3b8fc1e89962f21007dee6a Mon Sep 17 00:00:00 2001 From: Eric Richer Date: Tue, 12 Mar 2024 09:53:29 -0400 Subject: [PATCH 1/2] Adding GitHub actions for CI testing --- .github/workflows/build_test.yml | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/build_test.yml diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml new file mode 100644 index 0000000..79f4e71 --- /dev/null +++ b/.github/workflows/build_test.yml @@ -0,0 +1,61 @@ +name: Build + +on: + push: + pull_request: + +env: + COMPOSER_ARGS: '--no-progress' + +jobs: + build: + strategy: + matrix: + php_version: ['8.1', '8.2', '8.3'] + deps: ['--prefer-lowest --prefer-dist', ''] + include: + - code-coverage: 'yes' + php_version: '8.2' + 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 + + From 51d0d1ffba317a46871da02d87bffac510851a3e Mon Sep 17 00:00:00 2001 From: Eric Richer Date: Tue, 12 Mar 2024 16:01:50 -0400 Subject: [PATCH 2/2] Removed Travis-CI. Updated badges in README.md --- .travis.yml | 84 ----------------------------------------------------- README.md | 7 +++-- 2 files changed, 4 insertions(+), 87 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6baf508..0000000 --- a/.travis.yml +++ /dev/null @@ -1,84 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -env: - global: - - COMPOSER_ARGS="--no-interaction" - - XDEBUG_MODE=coverage - -services: - - mysql - -matrix: - fast_finish: true - allow_failures: - - php: nightly - include: - - php: 7.3 - env: - - DEPS=lowest - - php: 7.3 - env: - - DEPS=latest - - CS_CHECK=true - - TEST_COVERAGE=true - - php: 7.4 - env: - - DEPS=lowest - - php: 7.4 - env: - - DEPS=latest - - php: 8.0 - env: - - DEPS=lowest - - php: 8.0 - env: - - DEPS=latest - - php: 8.1 - env: - - DEPS=lowest - - php: 8.1 - env: - - DEPS=latest - - php: 8.2 - env: - - DEPS=lowest - - php: 8.2 - env: - - DEPS=latest - - php: nightly - env: - - DEPS=lowest - - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" - - php: nightly - env: - - DEPS=latest - - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" - -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 - - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi - - stty cols 120 && composer show - - wget https://scrutinizer-ci.com/ocular.phar - -before_script: - - mysql -e "create database IF NOT EXISTS lmc_user;" -uroot - -script: - - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi - - ./vendor/bin/phpcs -n --standard=PSR2 ./src/ ./tests/ - -after_script: - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - -notifications: - email: "mail@matwright.dev" diff --git a/README.md b/README.md index 9c1a813..0eee206 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ LmcUser ======= -[![Build Status](https://travis-ci.com/LM-Commons/LmcUser.svg?branch=master)](https://travis-ci.com/LM-Commons/LmcUser) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/LM-Commons/LmcUser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/LM-Commons/LmcUser/?branch=master) +[![Latest Stable Version](http://poser.pugx.org/lm-commons/lmc-user/v)](https://packagist.org/packages/lm-commons/lmc-user) +[![Total Downloads](http://poser.pugx.org/lm-commons/lmc-user/downloads)](https://packagist.org/packages/lm-commons/lmc-user) +[![Build](https://github.com/visto9259/LmcUser/actions/workflows/build_test.yml/badge.svg)](https://github.com/visto9259/LmcUser/actions/workflows/build_test.yml) [![Gitter](https://badges.gitter.im/LM-Commons/community.svg)](https://gitter.im/LM-Commons/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) Based on ZfcUser by Evan Coury and the ZF-Commons team @@ -43,7 +44,7 @@ Installation 1. Add this project in your composer.json: - ```json + ``` "require": { "lm-commons/lmc-user": "^3.1" }