Skip to content

Commit 1834785

Browse files
authored
Merge pull request #9 from benrowe/feature/laravel-11-support
Add laravel 11/12 support
2 parents 6f29b53 + 0343a61 commit 1834785

File tree

6 files changed

+129
-4681
lines changed

6 files changed

+129
-4681
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Continual Integration
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- feature/**
9+
- bugfix/**
10+
- dependabot/**
11+
12+
jobs:
13+
phpunit:
14+
name: PHPUnit (PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }})
15+
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
php-versions: ['8.1', '8.2', '8.3']
22+
laravel-versions: ['9.*', '10.*', '11.*', '12.*']
23+
exclude:
24+
- php-versions: '8.1'
25+
laravel-versions: '11.*' # Laravel 11 typically requires PHP 8.2+
26+
- php-versions: '8.1'
27+
laravel-versions: '12.*' # Laravel 12 typically requires PHP 8.2+
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Setup PHP
34+
uses: shivammathur/setup-php@v2
35+
with:
36+
php-version: ${{ matrix.php-versions }}
37+
38+
- name: Validate composer files
39+
run: composer validate --strict
40+
41+
- name: Cache Composer dependencies
42+
uses: actions/cache@v4
43+
with:
44+
path: vendor
45+
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-laravel-${{ matrix.laravel-versions }}
46+
restore-keys: |
47+
${{ runner.os }}-php-${{ matrix.php-versions }}-laravel-${{ matrix.laravel-versions }}
48+
${{ runner.os }}-php-${{ matrix.php-versions }}-laravel-
49+
${{ runner.os }}-php-${{ matrix.php-versions }}-
50+
51+
- name: Install Composer dependencies
52+
run: |
53+
composer install --prefer-dist --no-progress --no-interaction
54+
composer update "illuminate/support:${{ matrix.laravel-versions }}" "illuminate/container:${{ matrix.laravel-versions }}" --with-all-dependencies --prefer-dist --no-progress --no-interaction
55+
56+
- name: Run PHPUnit tests
57+
run: vendor/bin/phpunit

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Composer
22
/vendor/
3+
composer.lock
34

45
# IDE
56
.idea
@@ -13,3 +14,6 @@
1314

1415
# Test Coverage
1516
/test-reports
17+
18+
# OS
19+
.DS_Store

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM php:8.4-cli
2+
3+
RUN apt-get update && apt-get install -y \
4+
git \
5+
unzip \
6+
$PHPIZE_DEPS \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
RUN pecl install pcov && docker-php-ext-enable pcov
10+
11+
RUN echo "pcov.enabled=1" > /usr/local/etc/php/conf.d/99-pcov.ini
12+
13+
COPY --from=composer/composer:latest-bin /composer /usr/local/bin/composer
14+
15+
WORKDIR /app

Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
IMAGE_NAME := json-diff
3+
CURRENT_DIR := $(shell pwd)
4+
5+
.PHONY: help
6+
7+
# COLORS
8+
GREEN := $(shell tput -Txterm setaf 2)
9+
YELLOW := $(shell tput -Txterm setaf 3)
10+
WHITE := $(shell tput -Txterm setaf 7)
11+
RESET := $(shell tput -Txterm sgr0)
12+
13+
TARGET_MAX_CHAR_NUM=20
14+
15+
## Show help
16+
help:
17+
@echo ''
18+
@echo 'Usage:'
19+
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
20+
@echo ''
21+
@echo 'Targets:'
22+
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
23+
helpMessage = match(lastLine, /^## (.*)/); \
24+
if (helpMessage) { \
25+
helpCommand = substr($$1, 0, index($$1, ":")-1); \
26+
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
27+
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
28+
} \
29+
} \
30+
{ lastLine = $$0 }' $(MAKEFILE_LIST)
31+
32+
## Start and log into the container
33+
up: build run
34+
35+
## Build a new version of the container
36+
build:
37+
@docker build -t $(IMAGE_NAME) .
38+
39+
## Run the existing container
40+
run:
41+
@docker run -it --rm -v "$(CURRENT_DIR):/app" $(IMAGE_NAME) bash

composer.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "covergenius/json-diff",
3+
"description": "JSON Diff",
34
"type": "library",
4-
"license": "GNUv3",
5+
"license": "GPL-3.0-only",
56
"autoload": {
67
"psr-4": {
78
"Jet\\JsonDiff\\": "src/"
@@ -20,13 +21,16 @@
2021
},
2122
"authors": [
2223
{
23-
"name": "Jet Lim and Ruben Funai"
24+
"name": "Jet Lim"
25+
},
26+
{
27+
"name": "Ruben Funai"
2428
}
2529
],
2630
"require": {
2731
"php": "^8.0",
28-
"illuminate/support": "^9.0 || ^10.0",
29-
"illuminate/container": "^9.0 || ^10.0"
32+
"illuminate/support": "^9.0 || ^10.0 || ^11.0 || ^12.0",
33+
"illuminate/container": "^9.0 || ^10.0 || ^11.0 || ^12.0"
3034
},
3135
"require-dev": {
3236
"phpunit/phpunit": "^9.6",
@@ -41,8 +45,11 @@
4145
"lint": [
4246
"php-cs-fixer fix -v"
4347
],
44-
"test:with-coverage": [
48+
"test:coverage": [
4549
"phpunit --coverage-html ./test-reports"
50+
],
51+
"test": [
52+
"phpunit"
4653
]
4754
}
4855
}

0 commit comments

Comments
 (0)