Skip to content

Commit

Permalink
Update phpunit settings
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-gao committed Jan 28, 2022
1 parent 2e4c724 commit b5e57ab
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,35 @@ jobs:
INSTALL_SUGGEST: 1
BEHAT_PROFILE: "--profile=suggest"

phpunit_tests:
<<: *job-build
steps:
- attach_workspace:
at: /workspace
- checkout
- run: if [ -f "./dev-tools.sh" ] && [ ! "$DEV_TOOLS" ]; then ./dev-tools.sh; fi
- setup_remote_docker:
docker_layer_caching: true
- run: .circleci/build.sh
- run:
name: Run phpunit tests and generate coverage
command: |
.circleci/phpunit_tests.sh
.circleci/phpunit_coverage.sh
- run:
name: Run on fail tests
command: |
.circleci/phpunit_results.sh
when: always
- store_artifacts:
path: /tmp/phpunit
- store_test_results:
path: /tmp/phpunit

workflows:
version: 2
main:
jobs:
- build
- build_suggest
- phpunit_tests
7 changes: 7 additions & 0 deletions .circleci/phpunit_coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
##
# Generate coverage report
#
set -e
echo "==> Generate coverage report"
ahoy cli "phpdbg -qrr vendor/bin/phpunit ./dpc-sdp --coverage-html /app/phpunit/coverage-report"
6 changes: 6 additions & 0 deletions .circleci/phpunit_results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
##
# Moves phpunit results from inside container to outside.
#
set -e
docker cp $(docker-compose ps -q cli):/app/phpunit/ /tmp/
9 changes: 9 additions & 0 deletions .circleci/phpunit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
##
# Run phpunit tests in CI.
#
set -e

ahoy cli "mkdir -p /app/phpunit"
echo "==> Run phpunit tests"
ahoy cli "vendor/bin/phpunit ./dpc-sdp --log-junit /app/phpunit/junit.xml"

0 comments on commit b5e57ab

Please sign in to comment.