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

Add GitHub workflow elifesciences/issues#9002 #257

Merged
merged 3 commits into from
Oct 16, 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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<php>
<ini name="date.timezone" value="America/Los_Angeles"/> <!-- Make sure that we handle all dates as UTC even if the system's timezone is not UTC -->
<ini name="memory_limit" value="-1"/> <!-- The test suite needs more than the default memory limit on many systems -->
</php>

</phpunit>
Loading