Skip to content

Commit

Permalink
Merge pull request #11 from ngmy/feature/php8-support
Browse files Browse the repository at this point in the history
Support PHP 8.0
  • Loading branch information
ngmy committed Jan 7, 2021
2 parents 2b0c3e3 + c753708 commit c93ad2d
Show file tree
Hide file tree
Showing 39 changed files with 3,766 additions and 1,704 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
5 changes: 5 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
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
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: ngmy
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://flattr.com/@ngmy
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "laradock"]
path = laradock
url = https://github.com/Laradock/laradock.git
[submodule "laradockctl"]
path = laradockctl
url = https://github.com/ngmy/laradockctl.git
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
}
9 changes: 9 additions & 0 deletions .laradock/commands/my/down.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -Ceuo pipefail

local NAME='my:down'
local DESCRIPTION='Shut down my development environment'

handle() {
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 "$@"
}
25 changes: 25 additions & 0 deletions .laradock/commands/my/up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -Ceuo pipefail

local NAME='my:up'
local DESCRIPTION='Start up my development environment'

handle() {
cp -f ../.laradock/env-development .env
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
}
Empty file added .laradock/data/.gitkeep
Empty file.

0 comments on commit c93ad2d

Please sign in to comment.