Skip to content

Commit

Permalink
Clean Composer scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Jan 12, 2021
1 parent a36d90a commit 48e315f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,23 @@ jobs:
- name: Run analyse
run: |
composer run-script analyse
composer run-script code:analyse
- name: Run build test
if: ${{ !matrix.coverage }}
run: |
composer run-script test
composer run-script test-phar
composer run-script test:phar
- name: Run build test (coverage)
if: ${{ matrix.coverage && !matrix.experimental }}
run: |
composer run-script test-coverage
composer run-script test:coverage
- name: Upload coverage results to Coveralls
if: ${{ matrix.coverage && !matrix.experimental }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer run-script coverage-install
composer run-script coverage-upload
composer run-script test:coverage:install
composer run-script test:coverage:upload
8 changes: 4 additions & 4 deletions .travis.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ before_install:

install:
- travis_retry composer install -n --prefer-source
- if [[ $TEST_COVERAGE == true ]]; then travis_retry composer coverage-install || return 0 ; fi
- if [[ $TEST_COVERAGE == true ]]; then travis_retry composer test:coverage:install || return 0 ; fi

script: composer test

Expand All @@ -36,7 +36,7 @@ jobs:
- php: 8.0
- stage: code coverage
include:
- script: composer test-phar
- script: composer test:phar
name: "Build phar and run it"
php: 7.2
- stage: code coverage
Expand All @@ -47,9 +47,9 @@ jobs:
before_script:
- mkdir -p build/logs
script:
- travis_retry composer test-coverage
- travis_retry composer test:coverage
after_success:
- travis_retry composer coverage-upload
- travis_retry composer test:coverage:upload
- bash <(curl -s https://codecov.io/bash)
# deploy cecil.phar
- stage: deploy
Expand Down
30 changes: 21 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,35 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"analyse": "phpstan analyse src --memory-limit 1G --level=1 --no-progress --error-format=github",
"cs": "phpcs",
"code:analyse": "phpstan analyse src --memory-limit 1G --level=1 --no-progress --error-format=github",
"code:style": "phpcs",
"test": "phpunit -c ./",
"test-coverage": "phpunit -c ./ --coverage-text --coverage-clover build/logs/clover.xml",
"test-bin": "cd bin && mkdir skeleton && php cecil new:site skeleton -f && php cecil build skeleton -v && rm -rf skeleton",
"test-phar": "box compile && cd dist && mkdir skeleton && php cecil.phar new:site skeleton -f && php cecil.phar build skeleton -v && php cecil.phar show:content skeleton && rm -rf skeleton",
"box": "box compile",
"build": "@box",
"coverage-install": [
"test:coverage": "phpunit -c ./ --coverage-text --coverage-clover build/logs/clover.xml",
"test:coverage:install": [
"wget -c -nc --retry-connrefused --tries=0 https://github.com/php-coveralls/php-coveralls/releases/latest/download/php-coveralls.phar -O coveralls.phar",
"chmod +x coveralls.phar",
"php coveralls.phar --version"
],
"coverage-upload": "php coveralls.phar -v",
"test:coverage:upload": "php coveralls.phar -v",
"test:bin": "cd bin && mkdir skeleton && php cecil new:site skeleton -f && php cecil build skeleton -v && rm -rf skeleton",
"test:phar": "box compile && cd dist && mkdir skeleton && php cecil.phar new:site skeleton -f && php cecil.phar build skeleton -v && php cecil.phar show:content skeleton && rm -rf skeleton",
"build": "box compile",
"box": "@build",
"post-install-cmd": "cd ./tests/fixtures/website && composer install",
"post-update-cmd": "cd ./tests/fixtures/website && composer update"
},
"scripts-descriptions": {
"code:analyse": "Analyses code with PHPStan (PHP Static Analysis Tool).",
"code:style": "Corrects coding standard violations with PHP_CodeSniffer",
"test": "Runs functional tests suite.",
"test:coverage": "Runs functional tests suite with code coverage.",
"test:coverage:install": "Installs the php-coveralls binary.",
"test:coverage:upload": "Uploads tests coverage results.",
"test:bin": "Runs the binary to create a new skeleton site.",
"test:phar": "Builds the PHAR file and trys to create a new skeleton site.",
"build": "Builds the PHAR file.",
"box": "Alias of build."
},
"config": {
"platform": {
"php": "7.1.3"
Expand Down

0 comments on commit 48e315f

Please sign in to comment.