Skip to content

Commit

Permalink
Merge f6ca0a3 into 6212426
Browse files Browse the repository at this point in the history
  • Loading branch information
ngmy committed Jan 9, 2021
2 parents 6212426 + f6ca0a3 commit 64ffdcc
Show file tree
Hide file tree
Showing 22 changed files with 1,331 additions and 1,300 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
service_name: travis-ci
7 changes: 5 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export PATH=$PWD/laradockctl/bin:$PATH
export LARADOCKCTL_COMMAND_PATH=$PWD/.laradock/commands:$PWD/laradockctl/src/commands
if [[ -f .envrc.local ]]; then
source_env .envrc.local
fi

# vim: set ft=bash:
2 changes: 2 additions & 0 deletions .envrc.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export PATH=$PWD/laradockctl/bin:$PATH
export LARADOCKCTL_COMMAND_PATH=$PWD/.laradock/commands:$PWD/laradockctl/src/commands
154 changes: 154 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: PHP CI

on: [push, pull_request]

jobs:
install_tools:

runs-on: ubuntu-latest

name: Install tools

steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Install PHIVE
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: |
wget -O phive.phar https://phar.io/releases/phive.phar
wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc
gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79
gpg --verify phive.phar.asc phive.phar
- name: Install tools
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: |
php phive.phar --no-progress install \
--copy \
--trust-gpg-keys E82B2FB314E9906E,31C7E470E2138192,CF1A108D0E7AE720,4AA394086372C20A
- name: Upload tools to artifact store
uses: actions/upload-artifact@master
with:
name: tools
path: tools

test:

needs: install_tools

runs-on: ubuntu-latest

services:
mysql:
image: mysql
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: test

strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4', '8.0']
laravel: ['6', '7', '8']
deps: [highest, lowest]
include:
- php: '7.4'
laravel: '8'
deps: current

name: Test (PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }}, ${{ matrix.deps }} dependencies)

steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up PHP ${{ matrix.php }}
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php }}

- name: Update Composer to latest version
run: composer self-update

- name: Specify composer.json to use
run: |
if [[ "${{ matrix.laravel }}" == '6' ]]; then
export COMPOSER=composer-ci-laravel6.json
fi
if [[ "${{ matrix.laravel }}" == '7' ]]; then
export COMPOSER=composer-ci-laravel7.json
fi
if [[ "${{ matrix.laravel }}" == '8' ]]; then
export COMPOSER=composer-ci-laravel8.json
fi
- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache Composer packages
if: matrix.deps == 'current'
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: |
if [[ "${{ matrix.deps }}" == 'current' && "${{ steps.composer-cache.outputs.cache-hit }}" != 'true' ]]; then
composer install --no-interaction
fi
if [[ "${{ matrix.deps }}" == 'highest' ]]; then
composer update --no-interaction
fi
if [[ "${{ matrix.deps }}" == 'lowest' ]]; then
composer update --no-interaction --prefer-lowest --prefer-stable
fi
- name: Download tools from artifact store
uses: actions/download-artifact@master
with:
name: tools
path: tools

- name: Change MySQL authentication method
run: mysql -h 127.0.0.1 -u root -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY ''"

- name: Run lint
run: composer lint

- name: Run bug analysis
run: composer findbugs

- name: Run unit tests
env:
DB_HOST: '127.0.0.1'
DB_DATABASE: 'test'
DB_USERNAME: 'root'
DB_PASSWORD: ''
XDEBUG_MODE: coverage
run: composer test

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: php tools/php-coveralls --coverage_clover=build/logs/clover.xml -v
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/.laradock/data/*
!/.laradock/data/.gitkeep
/build/
/tools/
/vendor/
.envrc.local
.php_cs
.php_cs.cache
.phpunit.result.cache
/build/
/vendor/
phpcs.xml
phpstan.neon
phpunit.xml
14 changes: 14 additions & 0 deletions .laradock/commands/my/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -Ceuo pipefail

local NAME='my:destroy'
local DESCRIPTION='Destory my development environment'

handle() {
docker-compose down -v
local YN
read -p 'Do you want to remove data? (y/N)' YN
if [[ "${YN}" == 'y' ]]; then
sudo rm -rf ../.laradock/data/*
fi
}
2 changes: 1 addition & 1 deletion .laradock/commands/my/down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ local NAME='my:down'
local DESCRIPTION='Shut down my development environment'

handle() {
docker-compose down
docker-compose stop
}
9 changes: 9 additions & 0 deletions .laradock/commands/my/phive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -Ceuo pipefail

local NAME='my:phive'
local DESCRIPTION='Execute a PHIVE command'

handle() {
docker-compose exec -u laradock workspace phive --home .laradock/data/phive "$@"
}
18 changes: 16 additions & 2 deletions .laradock/commands/my/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ local DESCRIPTION='Start up my development environment'

handle() {
cp -f ../.laradock/env-development .env
docker-compose up -d --build workspace
docker-compose exec workspace composer install
docker-compose up -d --build mysql workspace
docker-compose exec -u laradock workspace composer install
cp ../phpunit.xml.dist ../phpunit.xml
sed -i 's/name="DB_HOST" value=""/name="DB_HOST" value="mysql"/g' ../phpunit.xml
sed -i 's/name="DB_DATABASE" value=""/name="DB_DATABASE" value="test"/g' ../phpunit.xml
sed -i 's/name="DB_USERNAME" value=""/name="DB_USERNAME" value="root"/g' ../phpunit.xml
sed -i 's/name="DB_PASSWORD" value=""/name="DB_PASSWORD" value="root"/g' ../phpunit.xml
if ! docker-compose exec workspace bash -c 'test -f /usr/local/bin/phive'; then
docker-compose exec workspace curl -fsSL https://phar.io/releases/phive.phar -o /tmp/phive.phar
docker-compose exec workspace curl -fsSL https://phar.io/releases/phive.phar.asc -o /tmp/phive.phar.asc
docker-compose exec workspace gpg --keyserver ipv4.pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79
docker-compose exec workspace gpg --verify /tmp/phive.phar.asc /tmp/phive.phar
docker-compose exec workspace chmod +x /tmp/phive.phar
docker-compose exec workspace mv /tmp/phive.phar /usr/local/bin/phive
fi
docker-compose exec -u laradock workspace phive --home .laradock/data/phive install
}
8 changes: 4 additions & 4 deletions .laradock/env-development
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ COMPOSE_PROJECT_NAME=laradock-eloquent-serialized-lob

# Select a PHP version of the Workspace and PHP-FPM containers (Does not apply to HHVM).
# Accepted values: 7.4 - 7.3 - 7.2 - 7.1 - 7.0 - 5.6
PHP_VERSION=7.2
PHP_VERSION=7.4

### Phalcon Version ###########################################

Expand Down Expand Up @@ -122,7 +122,7 @@ WORKSPACE_INSTALL_WORKSPACE_SSH=false
WORKSPACE_INSTALL_SUBVERSION=false
WORKSPACE_INSTALL_BZ2=false
WORKSPACE_INSTALL_GMP=false
WORKSPACE_INSTALL_XDEBUG=false
WORKSPACE_INSTALL_XDEBUG=true
WORKSPACE_INSTALL_PCOV=false
WORKSPACE_INSTALL_PHPDBG=false
WORKSPACE_INSTALL_SSH2=false
Expand All @@ -146,7 +146,7 @@ WORKSPACE_INSTALL_V8JS=false
WORKSPACE_INSTALL_LARAVEL_ENVOY=false
WORKSPACE_INSTALL_LARAVEL_INSTALLER=false
WORKSPACE_INSTALL_DEPLOYER=false
WORKSPACE_INSTALL_PRESTISSIMO=false
WORKSPACE_INSTALL_PRESTISSIMO=true
WORKSPACE_INSTALL_LINUXBREW=false
WORKSPACE_INSTALL_MC=false
WORKSPACE_INSTALL_SYMFONY=false
Expand Down Expand Up @@ -339,7 +339,7 @@ MYSQL_USER=default
MYSQL_PASSWORD=secret
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=root
MYSQL_ENTRYPOINT_INITDB=./mysql/docker-entrypoint-initdb.d
MYSQL_ENTRYPOINT_INITDB=../.laradock/mysql/docker-entrypoint-initdb.d

### CLICKHOUSE #################################################

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE DATABASE test;
7 changes: 7 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-coveralls" version="^2.4.3" installed="2.4.3" location="./tools/php-coveralls" copy="false"/>
<phar name="phpcs" version="^3.5.8" installed="3.5.8" location="./tools/phpcs" copy="false"/>
<phar name="phpstan" version="^0.12.64" installed="0.12.64" location="./tools/phpstan" copy="false"/>
<phar name="phpunit" version="^9.5.0" installed="9.5.0" location="./tools/phpunit" copy="false"/>
</phive>
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Latest Unstable Version](https://poser.pugx.org/ngmy/eloquent-serialized-lob/v/unstable)](https://packagist.org/packages/ngmy/eloquent-serialized-lob)
[![License](https://poser.pugx.org/ngmy/eloquent-serialized-lob/license)](https://packagist.org/packages/ngmy/eloquent-serialized-lob)
[![composer.lock](https://poser.pugx.org/ngmy/eloquent-serialized-lob/composerlock)](https://packagist.org/packages/ngmy/eloquent-serialized-lob)<br>
[![Build Status](https://travis-ci.org/ngmy/eloquent-serialized-lob.svg?branch=master)](https://travis-ci.org/ngmy/eloquent-serialized-lob)
[![PHP CI](https://github.com/ngmy/eloquent-serialized-lob/workflows/PHP%20CI/badge.svg)](https://github.com/ngmy/eloquent-serialized-lob/actions?query=workflow%3A%22PHP+CI%22)
[![Coverage Status](https://coveralls.io/repos/ngmy/eloquent-serialized-lob/badge.svg?branch=master)](https://coveralls.io/r/ngmy/eloquent-serialized-lob?branch=master)

Eloquent Serialized LOB is a trait for Laravel Eloquent models that allows [Serialized LOB pattern](http://martinfowler.com/eaaCatalog/serializedLOB.html).
Expand All @@ -14,8 +14,8 @@ Eloquent Serialized LOB is a trait for Laravel Eloquent models that allows [Seri

Eloquent Serialized LOB has the following requirements:

* PHP >= 7.2
* Laravel >= 5.6
* PHP >= 7.3
* Laravel >= 6.0

## Installation

Expand Down
69 changes: 69 additions & 0 deletions composer-ci-laravel6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "ngmy/eloquent-serialized-lob",
"description": "Eloquent Serialized LOB is a trait for Laravel Eloquent models that allows Serialized LOB pattern",
"keywords": [
"laravel",
"eloquent",
"serialized lob",
"semi-structured",
"json",
"xml"
],
"license": "MIT",
"authors": [
{
"name": "Yuta Nagamiya",
"email": "y.nagamiya@gmail.com"
}
],
"type": "library",
"require": {
"php": "^7.3|^8.0",
"doctrine/annotations": "^1.11.1",
"illuminate/support": "^6.0",
"jms/serializer": "^3.11.0"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "2.9.0",
"nunomaduro/larastan": "0.6.11",
"orchestra/testbench": "4.13.0"
},
"extra": {
"laravel": {
"providers": [
"Ngmy\\EloquentSerializedLob\\EloquentSerializedLobServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Ngmy\\EloquentSerializedLob\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Ngmy\\EloquentSerializedLob\\Tests\\": "tests",
"Ngmy\\EloquentSerializedLob\\Tests\\SampleProjects\\IssueDatabase\\": "tests/sample_projects/issue_database",
"Ngmy\\EloquentSerializedLob\\Tests\\SampleProjects\\OrganizationHierarchy\\": "tests/sample_projects/organization_hierarchy"
},
"classmap": [
"tests/database/migrations"
]
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"test": [
"@php tools/phpunit --colors=always"
],
"lint": [
"@php tools/phpcs --colors"
],
"findbugs": [
"@php tools/phpstan analyse --ansi"
]
}
}

0 comments on commit 64ffdcc

Please sign in to comment.