Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run CI on multiple PHP versions #108

Merged
merged 6 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
41 changes: 0 additions & 41 deletions .github/workflows/code-coverage.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/php.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
4 changes: 2 additions & 2 deletions phpunit.ci.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
stopOnFailure = "true">

<testsuites>
<testsuite name="Alma PHP Client Unit Test Suite Legacy">
<directory>tests/Unit/Legacy</directory>
<testsuite name="Alma PHP Client Unit Test Suite">
<directory>tests/Unit/{MYVERSION}</directory>
</testsuite>
</testsuites>
<filter>
Expand Down
Loading