-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from GetDKAN/support-php81
- Loading branch information
Showing
12 changed files
with
354 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,180 @@ | ||
version: 2.0 | ||
jobs: | ||
build: | ||
machine: | ||
image: ubuntu-2004:202010-01 | ||
environment: | ||
CC_TEST_REPORTER_ID: 2ecadaa1fe4b1917c00e1e9e79591bfa4dad375145696201016a1fd090e33577 | ||
working_directory: ~/repo | ||
# PHPUnit Composer min/max test. | ||
# TODO: Make our own orb out of this. | ||
|
||
version: 2.1 | ||
orbs: | ||
php: circleci/[email protected] | ||
|
||
commands: | ||
update-packages: | ||
description: | | ||
Update your composer packages with automated caching and best practices applied. | ||
parameters: | ||
app-dir: | ||
default: ~/project | ||
description: Path to the directory containing your composer.json file. Not needed if composer.json lives in the root. | ||
type: string | ||
cache-files-dir: | ||
default: /home/circleci/.composer/cache/files | ||
description: Absolute path to the file cache folder. This should be inline with "composer global config cache-files-dir --absolute". | ||
type: string | ||
cache-key: | ||
default: composer.lock | ||
description: If this file is updated a new cache bucket will be created. Recommended to use composer.lock. Use composer.json when composer.lock is absent. | ||
type: string | ||
cache-version: | ||
default: v1 | ||
description: Change the default cache version if you need to clear the cache for any reason. | ||
type: string | ||
install-flags: | ||
default: --no-interaction --prefer-dist | ||
description: | | ||
By default, packages will be installed with "composer install --no-interaction --prefer-dist", use this to override the standard install flags. | ||
type: string | ||
vendor-dir: | ||
default: vendor | ||
description: Relative path to the vendor folder. Relative to "app-dir". This should be inline with "composer config vendor-dir". | ||
type: string | ||
with-cache: | ||
default: true | ||
description: Enable automatic caching of your dependencies for increased speed. | ||
type: boolean | ||
steps: | ||
- checkout | ||
- when: | ||
condition: << parameters.with-cache >> | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- composer-deps-<<parameters.cache-version>>-{{ checksum "<<parameters.app-dir>>/<<parameters.cache-key>>" }} | ||
- run: | ||
name: Setup DDEV | ||
command: | | ||
curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh && bash install_ddev.sh | ||
if [ ! -f "composer.json" ] && [ ! -f "composer.lock" ]; then | ||
echo | ||
echo "---" | ||
echo "Unable to find your composer.json and composer.lock files. Did you forget to set the app-dir parameter?" | ||
echo "---" | ||
echo | ||
echo "Current directory: $(pwd)" | ||
echo | ||
echo | ||
echo "List directory: " | ||
echo | ||
ls | ||
exit 1 | ||
fi | ||
name: Verify composer.json and/or composer.lock exist | ||
working_directory: <<parameters.app-dir>> | ||
- run: | ||
command: composer update <<parameters.install-flags>> | ||
name: Updating Composer Packages | ||
working_directory: <<parameters.app-dir>> | ||
- when: | ||
condition: << parameters.with-cache >> | ||
steps: | ||
- save_cache: | ||
key: composer-deps-<<parameters.cache-version>>-{{ checksum "<<parameters.app-dir>>/<<parameters.cache-key>>" }} | ||
paths: | ||
- <<parameters.app-dir>>/<<parameters.vendor-dir>> | ||
- <<parameters.cache-files-dir>> | ||
install-xdebug: | ||
steps: | ||
- run: | ||
name: Install XDebug | ||
command: sudo -E install-php-extensions xdebug && sudo -E docker-php-ext-enable xdebug | ||
|
||
install-cc-test-reporter: | ||
# TODO: Parameterize location. | ||
steps: | ||
- run: | ||
name: Setup Code Climate test-reporter | ||
name: Install Codeclimate test reporter | ||
command: | | ||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | ||
chmod +x ./cc-test-reporter | ||
- run: | ||
name: Run tests | ||
command: | | ||
pwd | ||
ddev start | ||
ddev xdebug | ||
ddev composer install | ||
./cc-test-reporter before-build | ||
ddev exec ./vendor/bin/phpunit --testsuite all --coverage-clover clover.xml | ||
sed -i 's+/var/www/html/+/home/circleci/repo/+g' clover.xml | ||
./cc-test-reporter after-build --coverage-input-type clover --exit-code $? | ||
run-phpunit-tests: | ||
description: | | ||
Run PHPUnit tests. | ||
parameters: | ||
app-dir: | ||
default: ~/project | ||
description: Path to the directory containing your composer.json file. Not needed if composer.json lives in the root. | ||
type: string | ||
install-flags: | ||
default: "" | ||
description: Arguments to `composer update`. | ||
type: string | ||
test-command: | ||
default: test | ||
description: The name of the script within your composer.json which will run your tests. | ||
type: string | ||
report-to-codeclimate: | ||
type: boolean | ||
default: false | ||
description: Report coverage info to Codeclimate. | ||
steps: | ||
- checkout | ||
- update-packages: | ||
app-dir: <<parameters.app-dir>> | ||
cache-key: composer.json | ||
install-flags: <<parameters.install-flags>> | ||
- when: | ||
condition: <<parameters.report-to-codeclimate>> | ||
steps: | ||
- install-xdebug | ||
- install-cc-test-reporter | ||
- run: | | ||
./cc-test-reporter before-build | ||
XDEBUG_MODE=coverage composer <<parameters.test-command>> -- --coverage-clover clover.xml | ||
./cc-test-reporter after-build --coverage-input-type clover --exit-code $? | ||
- when: | ||
condition: | ||
not: <<parameters.report-to-codeclimate>> | ||
steps: | ||
- run: | | ||
XDEBUG_MODE=off composer <<parameters.test-command>> | ||
jobs: | ||
matrix-conditions: | ||
description: Run tests for matrix | ||
executor: | ||
name: php/default | ||
tag: << parameters.version >> | ||
parameters: | ||
version: | ||
default: "7.4" | ||
description: The `cimg/php` Docker image version tag. | ||
type: string | ||
install-flags: | ||
default: "" | ||
description: Arguments to `composer update`. | ||
type: string | ||
environment: | ||
CC_TEST_REPORTER_ID: 2ecadaa1fe4b1917c00e1e9e79591bfa4dad375145696201016a1fd090e33577 | ||
steps: | ||
- when: | ||
condition: | ||
and: | ||
- equal: [ "8.1", <<parameters.version>> ] | ||
- equal: [ "", <<parameters.install-flags>> ] | ||
steps: | ||
- run-phpunit-tests: | ||
report-to-codeclimate: true | ||
install-flags: << parameters.install-flags >> | ||
- when: | ||
condition: | ||
not: | ||
and: | ||
- equal: [ "8.1", <<parameters.version>> ] | ||
- equal: [ "", <<parameters.install-flags>> ] | ||
steps: | ||
- run-phpunit-tests: | ||
install-flags: << parameters.install-flags >> | ||
|
||
workflows: | ||
all-tests: | ||
jobs: | ||
- matrix-conditions: | ||
matrix: | ||
parameters: | ||
version: ["8.1", "8.0", "7.4"] | ||
install-flags: ["", "--prefer-lowest"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.ddev | ||
.idea | ||
vendor | ||
composer.lock | ||
/html |
Oops, something went wrong.