Skip to content

Commit

Permalink
Modernize the project
Browse files Browse the repository at this point in the history
  • Loading branch information
peteraba committed Mar 1, 2021
1 parent 0574cbe commit 4825005
Show file tree
Hide file tree
Showing 17 changed files with 3,381 additions and 1,077 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Creative CI

# Run this workflow every time a new commit pushed to your repository
on: push

jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
ci:
strategy:
matrix:
operating-system: [ ubuntu-latest, macos-latest ]
php-versions: [ '7.4' ]
# Name the Job
name: Lint code base
# Set the type of machine to run on
runs-on: ${{ matrix.operating-system }}

steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: ast, iconv, json, mbstring, pdo, tokenizer
coverage: xdebug #optional
ini-values: zend.assertions=1,assert.exception=1
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: make install

- name: Build the project
run: make build

- name: Coverage report
if: ${{ matrix.operating-system == 'ubuntu-latest' && matrix.php-versions == '7.4' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make coverage
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
composer.phar
nbproject/
phpunit.phar
/vendor/
NOTES.md
.phpunit.result.cache
tmp/report/*
vendor/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "docker"]
path = docker
url = https://github.com/abterphp/docker-configs
8 changes: 8 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
filter:
excluded_paths:
- 'vendor/*'

build:
environment:
php:
version: 7.4
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

38 changes: 22 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
install:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'baf1608c33254d00611ac1705c1d9958c817a1a33bce370c0595974b342601bd80b92a3f46067da89e3b06bff421f182') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar install
ifeq (,$(wildcard /usr/local/bin/composer))
./bin/composer-install.sh
mv composer.phar /usr/local/bin/composer
endif
ifeq (,$(wildcard /usr/local/bin/php-coveralls))
curl -L --output php-coveralls.phar https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar
mv php-coveralls.phar /usr/local/bin/php-coveralls
chmod +x /usr/local/bin/php-coveralls
endif
XDEBUG_MODE=off composer install --no-progress --prefer-dist --optimize-autoloader

update:
php composer.phar update
XDEBUG_MODE=off composer update

build:
./vendor/bin/phpunit
./vendor/bin/phpcs src
./vendor/bin/phpcs -p --colors --cache --standard=PSR12 tests
./vendor/bin/phpmd src text .phpmd.xml
PHAN_DISABLE_XDEBUG_WARN=1 ./vendor/bin/phan --color
XDEBUG_MODE=off ./vendor/bin/phpunit
XDEBUG_MODE=off ./vendor/bin/phpcs -p --colors --cache src
XDEBUG_MODE=off ./vendor/bin/phpcs -p --colors --cache --standard=PSR12 tests
XDEBUG_MODE=off ./vendor/bin/phpmd src text .phpmd.xml
XDEBUG_MODE=off ./vendor/bin/phan --color

precommit:
git diff --cached --name-only --diff-filter=ACM | grep \\.php | xargs -n 1 php -l
./vendor/bin/phpunit
./vendor/bin/phpcs src
./vendor/bin/phpcs -p --colors --cache --standard=PSR12 tests
XDEBUG_MODE=off ./vendor/bin/phpunit
XDEBUG_MODE=off ./vendor/bin/phpcs -p --colors --cache src
XDEBUG_MODE=off ./vendor/bin/phpcs -p --colors --cache --standard=PSR12 tests

unit:
./vendor/bin/phpunit
XDEBUG_MODE=off ./vendor/bin/phpunit

coverage:
./vendor/bin/phpunit -c phpunit-cov.xml
XDEBUG_MODE=coverage ./vendor/bin/phpunit -c phpunit-cov.xml
XDEBUG_MODE=off php-coveralls -vvv --coverage_clover=./tmp/report/clover.xml --json_path=./tmp/report/coveralls-upload.json

.PHONY: install update build precommit unit integration coverage
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
https://github.com/BlackrockDigital/startbootstrap-creative
# AbterPHP Website Creative

[![Build Status](https://github.com/abterphp/website-creative/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/abterphp/website-creative/actions)

This project adjusts the [Website module](https://github.com/abtercms/website) of [AbterPHP](https://github.com/abtercms/abterphp) to
use the [Creative theme](https://github.com/BlackrockDigital/startbootstrap-creative) from [Start Bootstrap](https://startbootstrap.com/).
17 changes: 17 additions & 0 deletions bin/composer-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi

php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
"abterphp/contact": "*"
},
"require-dev": {
"phpunit/phpunit": "^8.2",
"squizlabs/php_codesniffer": "^3.4",
"phpmd/phpmd": "^2.6",
"phan/phan": "^2.2"
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.5",
"phpmd/phpmd": "^2.9",
"friendsofphp/php-cs-fixer": "^2.18",
"phan/phan": "^4.0"
},
"config": {
"prefer-install": "dist"
Expand Down
Loading

0 comments on commit 4825005

Please sign in to comment.