diff --git a/.circleci/config.yml b/.circleci/config.yml index f894ae9a0..290823d49 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,6 +32,75 @@ jobs: - run: name: Static analysis command: ./psalm + test: + executor: php-72 + steps: + - attach_workspace: + at: /home/docker/project/ + - run: + name: PHPUnit test + command: php vendor/bin/phpunit --log-junit build/phpunit/phpunit.xml + - store_test_results: + path: build/phpunit/phpunit.xml + - store_artifacts: + path: build/phpunit + - persist_to_workspace: + root: /home/docker/project/ + paths: + - . + coverage: + executor: php-72 + steps: + - attach_workspace: + at: /home/docker/project/ + - run: + name: PHPUnit test with coverage + command: php -dextension=pcov.so vendor/bin/phpunit --log-junit build/phpunit/phpunit.xml --coverage-xml build/phpunit/coverage-xml --coverage-html build/phpunit/coverage-html + - store_artifacts: + path: build/phpunit + - persist_to_workspace: + root: /home/docker/project/ + paths: + - . + mutation: + executor: php-72 + steps: + - attach_workspace: + at: /home/docker/project/ + - run: + name: Install infection + command: composer global require infection/infection + - run: + name: Mutation coverage testing + command: php -d memory_limit=4G ~/.composer/vendor/bin/infection --coverage=build/phpunit + phar-build: + executor: php-72 + steps: + - attach_workspace: + at: /home/docker/project/ + - run: + name: Build Phar file + command: bin/build-phar.sh + - run: + name: Smoke test Phar file + command: build/psalm.phar --version + - store_artifacts: + path: build/psalm.phar + - persist_to_workspace: + root: /home/docker/project/ + paths: + - build/psalm.phar + test-with-real-projects: + executor: php-72 + steps: + - checkout # used here just for the side effect of loading the github public ssh key so we can clone other stuff + - attach_workspace: + at: /home/docker/project/ + - run: + name: Analyse PHPUnit + command: bin/test-with-real-projects.sh + - store_artifacts: + path: build/psalm.phar # Orchestrate or schedule a set of jobs, see https://circleci.com/docs/2.0/workflows/ workflows: @@ -41,3 +110,18 @@ workflows: - static-analysis: requires: - install + - test: + requires: + - static-analysis + - coverage: + requires: + - test + - mutation: + requires: + - coverage + - phar-build: + requires: + - test + - test-with-real-projects: + requires: + - phar-build diff --git a/bin/test-with-real-projects.sh b/bin/test-with-real-projects.sh new file mode 100755 index 000000000..abab52dd6 --- /dev/null +++ b/bin/test-with-real-projects.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e +set -x + +cd /tmp/ +mkdir testing-with-real-projects +cd testing-with-real-projects +git clone git@github.com:sebastianbergmann/phpunit.git + +cd phpunit +git checkout 24b6cfcec34c1167 # release 8.2.2 +composer install +~/project/build/psalm.phar --config=.psalm/config.xml \ No newline at end of file diff --git a/build/phpunit/.gitkeep b/build/phpunit/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/infection.json.dist b/infection.json.dist new file mode 100644 index 000000000..9d6bfffb7 --- /dev/null +++ b/infection.json.dist @@ -0,0 +1,14 @@ +{ + "timeout": 10, + "source": { + "directories": [ + "src" + ] + }, + "logs": { + "text": "build\/infection.log" + }, + "mutators": { + "@default": true + } +} \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index bbdf861fc..c68cd9f9d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,15 @@ + verbose="true" + executionOrder="default" +> tests