-
Notifications
You must be signed in to change notification settings - Fork 3
Add laravel 11/12 support #9
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
Changes from all commits
872791f
221a334
1ab104a
3502898
c24aae1
98281e0
1189046
1ce5fbe
9a3f301
43bfc4d
3d868df
3d81651
21b3213
0343a61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Continual Integration | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| - feature/** | ||
| - bugfix/** | ||
| - dependabot/** | ||
|
|
||
| jobs: | ||
| phpunit: | ||
| name: PHPUnit (PHP ${{ matrix.php-versions }}, Laravel ${{ matrix.laravel-versions }}) | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| php-versions: ['8.1', '8.2', '8.3'] | ||
| laravel-versions: ['9.*', '10.*', '11.*', '12.*'] | ||
| exclude: | ||
| - php-versions: '8.1' | ||
| laravel-versions: '11.*' # Laravel 11 typically requires PHP 8.2+ | ||
| - php-versions: '8.1' | ||
| laravel-versions: '12.*' # Laravel 12 typically requires PHP 8.2+ | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php-versions }} | ||
|
|
||
| - name: Validate composer files | ||
| run: composer validate --strict | ||
|
|
||
| - name: Cache Composer dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: vendor | ||
| key: ${{ runner.os }}-php-${{ matrix.php-versions }}-laravel-${{ matrix.laravel-versions }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-php-${{ matrix.php-versions }}-laravel-${{ matrix.laravel-versions }} | ||
| ${{ runner.os }}-php-${{ matrix.php-versions }}-laravel- | ||
| ${{ runner.os }}-php-${{ matrix.php-versions }}- | ||
|
|
||
| - name: Install Composer dependencies | ||
| run: | | ||
| composer install --prefer-dist --no-progress --no-interaction | ||
| composer update "illuminate/support:${{ matrix.laravel-versions }}" "illuminate/container:${{ matrix.laravel-versions }}" --with-all-dependencies --prefer-dist --no-progress --no-interaction | ||
|
|
||
| - name: Run PHPUnit tests | ||
| run: vendor/bin/phpunit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # Composer | ||
| /vendor/ | ||
| composer.lock | ||
|
|
||
| # IDE | ||
| .idea | ||
|
|
@@ -13,3 +14,6 @@ | |
|
|
||
| # Test Coverage | ||
| /test-reports | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| FROM php:8.4-cli | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| git \ | ||
| unzip \ | ||
| $PHPIZE_DEPS \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN pecl install pcov && docker-php-ext-enable pcov | ||
|
|
||
| RUN echo "pcov.enabled=1" > /usr/local/etc/php/conf.d/99-pcov.ini | ||
|
|
||
| COPY --from=composer/composer:latest-bin /composer /usr/local/bin/composer | ||
|
|
||
| WORKDIR /app |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thing of beauty 😍 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
|
|
||
| IMAGE_NAME := json-diff | ||
| CURRENT_DIR := $(shell pwd) | ||
|
|
||
| .PHONY: help | ||
|
|
||
| # COLORS | ||
| GREEN := $(shell tput -Txterm setaf 2) | ||
| YELLOW := $(shell tput -Txterm setaf 3) | ||
| WHITE := $(shell tput -Txterm setaf 7) | ||
| RESET := $(shell tput -Txterm sgr0) | ||
|
|
||
| TARGET_MAX_CHAR_NUM=20 | ||
|
|
||
| ## Show help | ||
| help: | ||
| @echo '' | ||
| @echo 'Usage:' | ||
| @echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}' | ||
| @echo '' | ||
| @echo 'Targets:' | ||
| @awk '/^[a-zA-Z\-\_0-9]+:/ { \ | ||
| helpMessage = match(lastLine, /^## (.*)/); \ | ||
| if (helpMessage) { \ | ||
| helpCommand = substr($$1, 0, index($$1, ":")-1); \ | ||
| helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
| printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \ | ||
| } \ | ||
| } \ | ||
| { lastLine = $$0 }' $(MAKEFILE_LIST) | ||
|
|
||
| ## Start and log into the container | ||
| up: build run | ||
|
|
||
| ## Build a new version of the container | ||
| build: | ||
| @docker build -t $(IMAGE_NAME) . | ||
|
|
||
| ## Run the existing container | ||
| run: | ||
| @docker run -it --rm -v "$(CURRENT_DIR):/app" $(IMAGE_NAME) bash |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| { | ||
| "name": "covergenius/json-diff", | ||
| "description": "JSON Diff", | ||
| "type": "library", | ||
| "license": "GNUv3", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. composer validate does not recognise this license key.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! ❤️ |
||
| "license": "GPL-3.0-only", | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Jet\\JsonDiff\\": "src/" | ||
|
|
@@ -20,13 +21,16 @@ | |
| }, | ||
| "authors": [ | ||
| { | ||
| "name": "Jet Lim and Ruben Funai" | ||
| "name": "Jet Lim" | ||
| }, | ||
| { | ||
| "name": "Ruben Funai" | ||
| } | ||
| ], | ||
| "require": { | ||
| "php": "^8.0", | ||
| "illuminate/support": "^9.0 || ^10.0", | ||
| "illuminate/container": "^9.0 || ^10.0" | ||
| "illuminate/support": "^9.0 || ^10.0 || ^11.0 || ^12.0", | ||
| "illuminate/container": "^9.0 || ^10.0 || ^11.0 || ^12.0" | ||
| }, | ||
| "require-dev": { | ||
| "phpunit/phpunit": "^9.6", | ||
|
|
@@ -41,8 +45,11 @@ | |
| "lint": [ | ||
| "php-cs-fixer fix -v" | ||
| ], | ||
| "test:with-coverage": [ | ||
| "test:coverage": [ | ||
| "phpunit --coverage-html ./test-reports" | ||
| ], | ||
| "test": [ | ||
| "phpunit" | ||
| ] | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget Windows! 🥳