Skip to content

Commit

Permalink
Merge pull request #9 from sburba/feature/faster-builds
Browse files Browse the repository at this point in the history
Feature/faster builds
  • Loading branch information
sburba committed Apr 11, 2019
2 parents 4068adf + a2c5c36 commit 7235792
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 27 deletions.
31 changes: 22 additions & 9 deletions .circleci/config.yml
Expand Up @@ -2,20 +2,33 @@ version: 2
jobs:
build:
docker:
- image: "circleci/buildpack-deps"
- image: "circleci/php:7.3-cli"
steps:
- checkout
- setup_remote_docker:
docker_layer_caching: true
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.lock" }}
- composer-v1-
- run:
name: Build Docker image
command: "./scripts/build_docker.sh"
name: Install Dependencies
command: "composer install -n --prefer-dist --no-progress"
- save_cache:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor
- run:
name: Check code style
name: Check Code Style
command: "./scripts/check_code_style.sh"
- run:
name: Run tests
name: Run Tests
command: "./scripts/run_tests.sh"
- run:
name: Run mutation tests
command: "./scripts/run_infection.sh"
name: Run Mutation Tests
command: "./scripts/run_mutation_tests.sh"
- store_test_results:
path: test-results/
- store_artifacts:
path: test-results/
- run:
name: Upload Coverage Report
command: "bash <(curl -s https://codecov.io/bash)"
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -3,7 +3,8 @@
*.iml
# Tool files
.phpunit.result.cache
infection.log
.php_cs.cache
# Tool output directory
test-results
# Dependencies
vendor
4 changes: 3 additions & 1 deletion infection.json.dist
Expand Up @@ -6,7 +6,9 @@
]
},
"logs": {
"text": "infection.log"
"text": "test-results/infection/infection.log",
"summary": "test-results/infection/summary.txt",
"perMutator": "test-results/infection/per_mutator.md"
},
"mutators": {
"@default": true,
Expand Down
6 changes: 6 additions & 0 deletions phpunit.xml
Expand Up @@ -11,4 +11,10 @@
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="junit" target="test-results/phpunit/phpunit.junit.xml"/>
<log type="coverage-xml" target="test-results/phpunit/coverage-xml"/>
<log type="coverage-clover" target="test-results/phpunit/coverage.clover.xml"/>
<log type="coverage-html" target="test-results/phpunit/coverage-report"/>
</logging>
</phpunit>
6 changes: 6 additions & 0 deletions scripts/check_all.sh
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail

scripts/check_code_style.sh
scripts/run_tests.sh
scripts/run_mutation_tests.sh
2 changes: 1 addition & 1 deletion scripts/check_code_style.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

$(dirname $0)/run_in_docker.sh vendor/bin/php-cs-fixer fix . --dry-run
vendor/bin/php-cs-fixer fix . --dry-run
8 changes: 1 addition & 7 deletions scripts/run_in_docker.sh
@@ -1,10 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

if [[ -z ${CI:-} ]]; then
docker_args="-tv $(pwd):/app -u $(id -u):$(id -g)"
else
docker_args=""
fi

docker run ${docker_args} strict-json "$@"
docker run --rm -itv $(pwd):/app -u $(id -u):$(id -g) strict-json "$@"
7 changes: 0 additions & 7 deletions scripts/run_infection.sh

This file was deleted.

8 changes: 8 additions & 0 deletions scripts/run_mutation_tests.sh
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

vendor/bin/infection \
--threads=$(nproc) \
--coverage=test-results/phpunit/ \
--min-msi=89 \
--min-covered-msi=92
2 changes: 1 addition & 1 deletion scripts/run_tests.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail

$(dirname $0)/run_in_docker.sh vendor/bin/phpunit
vendor/bin/phpunit

0 comments on commit 7235792

Please sign in to comment.