diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..e650bc94 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: Continuous integration + +on: + workflow_dispatch: ~ + push: + branches: + - develop + - main + pull_request: + branches: + - develop + - main + +jobs: + ci: + name: Linting, tests and coverage + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + php: + - version: 5.6 + unittest-version: Legacy + - version: 7.0 + unittest-version: PHP7_0 + - version: 7.1 + unittest-version: PHP7_0 + - version: 7.2 + unittest-version: PHP7_2 + - version: 7.3 + unittest-version: PHP7_2 + - version: 7.4 + unittest-version: PHP7_2 + - version: 8.0 + unittest-version: PHP7_2 + - version: 8.1 + unittest-version: PHP8_1 + - version: 8.2 + unittest-version: PHP8_1 + - version: 8.3 + unittest-version: PHP8_1 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php.version }} + tools: composer:v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Prepare unittests configuration + run: sed -i 's/{MYVERSION}/${{ matrix.php.unittest-version }}/g' phpunit.ci.xml + + - name: Ensure source code is linted + run: ./vendor/bin/phpcs src + + - name: PHPUnit + run: ./vendor/bin/phpunit -c phpunit.ci.xml --coverage-xml ./.coverage + env: + XDEBUG_MODE: coverage + + - name: PHPUnit threshold + run: php ./phpunit-threshold.php diff --git a/.github/workflows/code-coverage.yaml b/.github/workflows/code-coverage.yaml deleted file mode 100644 index 52f60816..00000000 --- a/.github/workflows/code-coverage.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: PHPUnit Coverage Report - -on: - push: - branches: [develop, main] - pull_request: - branches: [develop, main] - workflow_dispatch: ~ - -jobs: - ci: - runs-on: ubuntu-22.04 - defaults: - run: - working-directory: ./ - - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 5.6 - tools: composer:v1 - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Ensure source code is linted - run: ./vendor/bin/phpcs src - - - name: PHPUnit - run: ./vendor/bin/phpunit -c phpunit.ci.xml --coverage-xml ./.coverage - env: - XDEBUG_MODE: coverage - - - name: PHPUnit threshold - run: php ./phpunit-threshold.php diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml deleted file mode 100644 index 6e1e7b46..00000000 --- a/.github/workflows/php.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: PHP Lint and unit tests - -on: - push: - branches: [main] - pull_request: - branches: [main] - workflow_dispatch: ~ - -jobs: - ci: - runs-on: ubuntu-22.04 - defaults: - run: - working-directory: ./ - - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 5.6 - tools: composer:v1 - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Install dependencies - run: composer install --prefer-dist --no-progress --no-suggest - - - name: Ensure source code is linted - run: ./vendor/bin/phpcs src - - - name: Ensure unit test are green - run: ./vendor/bin/phpunit -c phpunit.ci.xml diff --git a/README.md b/README.md index 77609ddb..eea3d897 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you find yourself needing to use some endpoints that are not yet implemented, Installation ------------ -The Alma PHP API Client library requires at least PHP 5.6. +The Alma PHP API Client library is tested against all recently supported PHP versions. A modern, [supported PHP version](https://www.php.net/supported-versions.php) is highly recommended. ### Composer diff --git a/composer.json b/composer.json index c6434a71..060c58bc 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "version": "2.0.7", "type": "library", "require": { - "php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4 || ~8.0 || ~8.1 || ~8.2", + "php": "^5.6 || ~7.0 || ~7.1 || ~7.2 || ~7.3 || ~7.4 || ~8.0 || ~8.1 || ~8.2 || ~8.3", "psr/log": "^1 || ^2 || ^3", "ext-curl": "*", "ext-json": "*", diff --git a/phpunit.ci.xml b/phpunit.ci.xml index 9e3d4842..891c8802 100644 --- a/phpunit.ci.xml +++ b/phpunit.ci.xml @@ -11,8 +11,8 @@ stopOnFailure = "true"> - - tests/Unit/Legacy + + tests/Unit/{MYVERSION}