From 8f922fa194c3d90f54478ee53d08f9aa956b3472 Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Wed, 16 Oct 2024 06:10:38 +0100 Subject: [PATCH 1/3] Add github workflow elifesciences/issues#9002 --- .github/workflows/ci.yaml | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 5 +++++ Makefile | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/ci.yaml create mode 100644 Dockerfile create mode 100644 Makefile diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..6158748d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,35 @@ +name: CI Pipeline + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - ready_for_review + push: + branches: + - master + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + php_version: [7.1, 7.2, 7.3, 7.4] + task: ['test', 'test-lowest'] + steps: + - uses: actions/checkout@v4 + - name: Run tests + run: make PHP_VERSION=${{ matrix.php_version }} ${{ matrix.task }} + tests-future-versions: + runs-on: ubuntu-latest + strategy: + matrix: + php_version: [8.0, 8.1, 8.2, 8.3] + task: ['test', 'test-lowest'] + steps: + - uses: actions/checkout@v4 + - name: Run tests against all major versions of PHP + run: make PHP_VERSION=${{ matrix.php_version }} ${{ matrix.task }} + continue-on-error: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..3bd78acb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +ARG PHP_VERSION=7.4 +FROM php:${PHP_VERSION} + +RUN apt-get update && apt-get install -y git unzip && rm -rf /var/lib/apt/lists/* +COPY --from=composer:2.2 /usr/bin/composer /usr/bin/composer diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..5cef6930 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +.PHONY: build test clean test +build: + $(if $(PHP_VERSION),,$(error PHP_VERSION make variable needs to be set)) + docker buildx build --build-arg=PHP_VERSION=$(PHP_VERSION) -t php-composer:$(PHP_VERSION) . + +lint: build + docker run --rm -v ./:/code -v/code/vendor php-composer:$(PHP_VERSION) bash -c 'cd /code && composer update && vendor/bin/phpcs --standard=phpcs.xml.dist --warning-severity=0 -p src/ test/' + +test: build lint + docker run --rm -v ./:/code -e dependencies=highest -v/code/vendor php-composer:$(PHP_VERSION) bash -c 'cd /code && composer update && ./project_tests.sh' + +test-lowest: build lint + docker run --rm -v ./:/code -e dependencies=lowest -v/code/vendor php-composer:$(PHP_VERSION) bash -c 'cd /code && ./project_tests.sh' + + +test-7.1: + @$(MAKE) PHP_VERSION=7.1 test test-lowest +test-7.2: + @$(MAKE) PHP_VERSION=7.2 test test-lowest +test-7.3: + @$(MAKE) PHP_VERSION=7.3 test test-lowest +test-7.4: + @$(MAKE) PHP_VERSION=7.4 test test-lowest +test-8.0: + @$(MAKE) PHP_VERSION=8.0 test test-lowest +test-8.1: + @$(MAKE) PHP_VERSION=8.1 test test-lowest +test-8.2: + @$(MAKE) PHP_VERSION=8.2 test test-lowest +test-8.3: + @$(MAKE) PHP_VERSION=8.3 test test-lowest + +test-all: test-7.1 test-7.2 test-7.3 test-7.4 test-8.0 test-8.1 test-8.2 test-8.3 + +test-all-supported: test-7.1 test-7.2 test-7.3 test-7.4 From 65ae419af73e4f9a7186042a9c8ae2a1bac9b325 Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Wed, 16 Oct 2024 06:11:05 +0100 Subject: [PATCH 2/3] set the PHPUnit test runner to disable PHP memory limit --- phpunit.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ca0e1d4c..fe784b29 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -18,6 +18,7 @@ + From 9daf6d8556df933a444b810f838e8d0b1643127f Mon Sep 17 00:00:00 2001 From: Scott Aubrey Date: Wed, 16 Oct 2024 06:12:16 +0100 Subject: [PATCH 3/3] bump minimum supported PHP version to 7.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4f7ed1e1..f4095000 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } }, "require": { - "php": "^7.0", + "php": "^7.1", "composer/package-versions-deprecated": "1.11.99.2", "elife/api-client": "^1.0@dev", "guzzlehttp/promises": "^1.0",