From 39a2f86ce765a9f1f7be18c1725bd3ae77456d9f Mon Sep 17 00:00:00 2001 From: Patrick Figel Date: Tue, 3 Mar 2020 16:11:40 +0100 Subject: [PATCH] Add CI --- .circleci/config.yml | 132 +++++++++++++++++++++++++++++++++++++++++++ README.md | 2 + 2 files changed, 134 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..03e2b51 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,132 @@ +version: 2.1 +commands: + install_civicrm: + description: "Install CiviCRM" + parameters: + build_name: + type: string + default: master + type: + type: string + default: drupal-clean + version: + type: string + default: master + url: + type: string + default: http://localhost:8080 + steps: + - run: | + civiver=<< parameters.version >> + if [[ "$civiver" == "stable" ]]; then + civiver=$(curl -s 'https://latest.civicrm.org/stable.php') + fi + su - buildkit -c "/buildkit/bin/civibuild create << parameters.build_name >> --civi-ver $civiver --type << parameters.type >> --url << parameters.url >>" + install_extension: + description: "Install Extension" + parameters: + build_name: + type: string + default: master + steps: + - run: | + EXT_DIR=/buildkit/build/<< parameters.build_name >>/web/sites/default/files/civicrm/ext/$CIRCLE_PROJECT_REPONAME + cp /root/project $EXT_DIR -r + chown buildkit:buildkit $EXT_DIR -R + cd $EXT_DIR + su - buildkit -c "cd /buildkit/build/<< parameters.build_name >>/web && cv en $CIRCLE_PROJECT_REPONAME" + run_civilint: + description: "Run civilint" + parameters: + build_name: + type: string + default: master + steps: + - run: su - buildkit -c "cd /buildkit/build/<< parameters.build_name >>/web/sites/default/files/civicrm/ext/$CIRCLE_PROJECT_REPONAME && find . -type f -not -path './vendor/*' | civilint -" + run_phpunit: + description: "Run PHPUnit" + parameters: + build_name: + type: string + default: master + steps: + - run: | + mkdir -p /phpunit /coverage + chown buildkit:buildkit /phpunit /coverage + su - buildkit -c "cd /buildkit/build/<< parameters.build_name >>/web/sites/default/files/civicrm/ext/$CIRCLE_PROJECT_REPONAME && phpdbg -qrr /buildkit/bin/phpunit5 --log-junit /phpunit/<< parameters.build_name >>/junit.xml --coverage-html /coverage/<< parameters.build_name >>" + run_all: + description: "Run all steps" + parameters: + build_name: + type: string + default: master + type: + type: string + default: drupal-clean + version: + type: string + default: master + url: + type: string + default: http://localhost:8080 + steps: + - install_civicrm: + build_name: << parameters.build_name >> + type: << parameters.type >> + version: << parameters.version >> + url: << parameters.url >> + - install_extension: + build_name: << parameters.build_name >> + # TODO: enable civilint + # - run_civilint: + # build_name: << parameters.build_name >> + - run_phpunit: + build_name: << parameters.build_name >> + - store_test_results: + path: /phpunit + - store_artifacts: + path: /phpunit + - store_artifacts: + path: /coverage + +executors: + civicrm: + docker: + - image: michaelmcandrew/civicrm-buildkit + name: civicrm + environment: + TERM: xterm-color + APACHE_RUN_USER: buildkit + - image: mysql:5.7 + name: mysql + environment: + MYSQL_ROOT_PASSWORD: buildkit + - image: djfarrelly/maildev + name: maildev + +jobs: + build: + executor: civicrm + steps: + - checkout + - run_all + - run_all: + build_name: civi-stable + version: "stable" + url: http://localhost:8081 + +workflows: + version: 2 + build: + jobs: + - build + nightly: + triggers: + - schedule: + cron: "0 5 * * *" + filters: + branches: + only: + - master + jobs: + - build diff --git a/README.md b/README.md index f11cc49..677e4f5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # webshoptools +[![CircleCI](https://circleci.com/gh/greenpeace-cee/webshoptools.svg?style=svg)](https://circleci.com/gh/greenpeace-cee/webshoptools) + This CiviCRM extension provides some behind-the-scenes tooling for an activity-based webshop process. The extension is licensed under [AGPL-3.0](LICENSE.txt).