{"id":13852670,"url":"https://github.com/LionsAd/drupal_ti","last_synced_at":"2025-07-13T06:30:49.119Z","repository":{"id":23919850,"uuid":"27300340","full_name":"LionsAd/drupal_ti","owner":"LionsAd","description":"Drupal - Travis Integration","archived":false,"fork":false,"pushed_at":"2021-02-05T07:44:44.000Z","size":224,"stargazers_count":81,"open_issues_count":27,"forks_count":37,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-26T06:10:31.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LionsAd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-29T11:39:31.000Z","updated_at":"2025-01-20T05:19:05.000Z","dependencies_parsed_at":"2022-08-22T07:50:49.079Z","dependency_job_id":null,"html_url":"https://github.com/LionsAd/drupal_ti","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/LionsAd/drupal_ti","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionsAd%2Fdrupal_ti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionsAd%2Fdrupal_ti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionsAd%2Fdrupal_ti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionsAd%2Fdrupal_ti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LionsAd","download_url":"https://codeload.github.com/LionsAd/drupal_ti/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LionsAd%2Fdrupal_ti/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265098887,"owners_count":23711217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T22:01:31.579Z","updated_at":"2025-07-13T06:30:48.795Z","avatar_url":"https://github.com/LionsAd.png","language":"Shell","funding_links":[],"categories":["Shell","CI template examples"],"sub_categories":[],"readme":"# drupal\\_ti - Travis Integration for Drupal modules\n\n[![Build Status](https://travis-ci.org/LionsAd/drupal_ti.svg?branch=master)](https://travis-ci.org/LionsAd/drupal_ti)\n\n# Versions\n\n[![Latest Stable Version](https://poser.pugx.org/lionsad/drupal_ti/v/stable)](https://packagist.org/packages/lionsad/drupal_ti) [![Total Downloads](https://poser.pugx.org/lionsad/drupal_ti/downloads)](https://packagist.org/packages/lionsad/drupal_ti) [![Latest Unstable Version](https://poser.pugx.org/lionsad/drupal_ti/v/unstable)](https://packagist.org/packages/lionsad/drupal_ti) [![License](https://poser.pugx.org/lionsad/drupal_ti/license)](https://packagist.org/packages/lionsad/drupal_ti)\n\n### Welcome!\n\nWelcome and thanks for trying drupal\\_ti!\n\nThis will make it simple to use Travis CI to test your Drupal modules with simpletest and PHPUnit tests.\n\nAll you need is to push your drupal.org repository to GitHub, set up the module below, log in to travis-ci.org, set up the repo and you are up and running in no time.\n\n### Setup\n\nCopy .travis.yml.dist to your root folder as .travis.yml and customize the `DRUPAL_TI_MODULE_NAME` global environment variable to match the name of your module.\n\nYou will also need to activate one matrix option, based on if you have support for SimpleTest, PHPUnit, Behat or all together:\n\n```yml\nenv:\n  matrix:\n    # [[[ SELECT ANY OR MORE OPTIONS ]]]\n    - DRUPAL_TI_RUNNERS=\"phpunit\" \n    - DRUPAL_TI_RUNNERS=\"phpunit simpletest behat\" \n```\n\nThis example would run PHPUnit as one matrix runner, which gives you results fast, then PHPUnit, SimpleTest and Behat as the slow runner.\n\nIf you want to run drupal_ti with a Drupal-8 module, then you need to use:\n\n```yml\n- DRUPAL_TI_ENVIROMENT=\"drupal-8\"\n```\n\nIf you want to run drupal_ti with a Drupal-9 module, then you need to use:\n\n```yml\n- DRUPAL_TI_ENVIROMENT=\"drupal-9\"\n```\n\n### Using a different tests/ directory.\n\nIf your tests/ and composer.json are not in tests/ directory you will want to change:\n\n```yml\nbefore_install:\n# Comment this line for different directories, e.g. composer in the root.\n#  - cd ./tests\n```\n\n### How does it work\n\ndrupal\\_ti provides a drupal-ti command, which is then called with each stage of Travis CI (e.g. `install`, `before_script`, ...).\n\nBy providing different runners in runners/simpletest or runners/phpunit/ the corresponding scripts are executed (e.g. runners/phpunit/script.sh).\n\nAlso diffent environments are included from `environments/$DRUPAL_TI_ENVIRONMENT.sh`, which makes it possible to distinguish easily between Drupal 7, Drupal 8 \u0026 Drupal 9.\n\nThis gives you a modular Travis experience and as such the scripts can be very generic.\n\nDrupal is installed in `$TRAVIS_BUILD_DIR/drupal_travis/drupal` and Drush is available after the `before_script` stage.\n\n### How to customize the default behavior\n\nBy using\n\n```yml\n- DRUPAL_TI_SCRIPT_DIR_BEFORE=\"./drupal_ti/before\"\n- DRUPAL_TI_SCRIPT_DIR_AFTER=\"./drupal_ti/after\"\n```\n\nyou can define your own scripts from your base directory, and drupal\\_ti will call them before and after your main scripts.\n\nThis is useful to change default environment variables, e.g. environments/drupal-7.sh defines\n\n```yml\nexport DRUPAL_TI_DRUSH_VERSION=\"drush/drush:6.*\"\n```\n\nbut you might want a different version and also override the `drupal_ti_install_drupal` function (as core-quick-drupal command needs drush 6).\n\nTheoretically you can even define multiple by just seperating them with a space or installed via Composer - the possibilities are endless :).\n\nExample:\n\n```yml\n- DRUPAL_TI_SCRIPT_DIR_BEFORE=\"./drupal_ti/before ./vendor/lionsad/drupal_ti_base_cool/drupal_ti/before\"\n- DRUPAL_TI_SCRIPT_DIR_AFTER=\"./drupal_ti/after  ./vendor/lionsad/drupal_ti_base_cool/drupal_ti/after\"\n```\n\n### Adding module dependencies from GitHub repositories\n\nYour module may have several dependencies that are not hosted on Drupal.org. These modules can be added using a custom script and `including` them in the `.travis.yml` file.\n\nIn `.travis.yml` you will have a section `before_script`. The default command here installs Drupal and the module we are testing. We can add a command `drupal-ti --include [script]`. This command will load the script first and then run the default `drupal-ti before_script` command.\n\n#### .travis.yml\n```yml\nbefore_script:\n  # We run our script to add module dependencies\n  # This uses git clone over HTTPS because the modules don't currently\n  # exist on drupal.org.\n  - drupal-ti --include drupal_ti/before/before_script.sh\n  - drupal-ti before_script\n```\n\nThe script path is relative to our `/tests` directory since we moved to that default directory during the `before_install` process.\n\nWe can now create our custom script as follows:\n\n#### /tests/drupal_ti/before/before_script.sh\n```bash\n#!/bin/bash\n\n# Add an optional statement to see that this is running in Travis CI.\necho \"running drupal_ti/before/before_script.sh\"\n\nset -e $DRUPAL_TI_DEBUG\n\n# Ensure the right Drupal version is installed.\n# The first time this is run, it will install Drupal.\n# Note: This function is re-entrant.\ndrupal_ti_ensure_drupal\n\n# Change to the Drupal directory\ncd \"$DRUPAL_TI_DRUPAL_DIR\"\n\n# Create the module directory (only necessary for D7)\n# For D7, this is sites/default/modules\n# For D8, this is modules\nmkdir -p \"$DRUPAL_TI_DRUPAL_DIR/$DRUPAL_TI_MODULES_PATH\"\ncd \"$DRUPAL_TI_DRUPAL_DIR/$DRUPAL_TI_MODULES_PATH\"\n\n# Manually clone the dependencies\ngit clone --depth 1 https://github.com/my-project/my-dependency.git\n# or with a different branch\ngit clone --depth 1 --branch 8.x-1.x https://github.com/my-project/my-dependency.git\n```\n\nThe directory `/tests/drupal_ti/before/` can also be used to add auto-discovered scripts using a more complex pattern `/tests/before/runners/[runner]/[command].sh`. This will, however be limited to a specific runner, while the above `include` pattern will run for all runners.\n\n#### Script with Composer Manager\nComposer manager is a popular dependency and one that requires extra work in order to be set up.\n\n```bash\n#!/bin/bash\n\n# Add an optional statement to see that this is running in Travis CI.\necho \"running drupal_ti/before/before_script.sh\"\n\nset -e $DRUPAL_TI_DEBUG\n\n# Ensure the right Drupal version is installed.\n# The first time this is run, it will install Drupal.\n# Note: This function is re-entrant.\ndrupal_ti_ensure_drupal\n\n# Change to the Drupal directory\ncd \"$DRUPAL_TI_DRUPAL_DIR\"\n\n# Create the module directory (only necessary for D7)\n# For D7, this is sites/default/modules\n# For D8, this is modules\nmkdir -p \"$DRUPAL_TI_DRUPAL_DIR/$DRUPAL_TI_MODULES_PATH\"\ncd \"$DRUPAL_TI_DRUPAL_DIR/$DRUPAL_TI_MODULES_PATH\"\n\n# Manually clone the dependencies\ngit clone --depth 1 --branch 8.x-1.x http://git.drupal.org/project/composer_manager.git\n\n# Initialize composer manage\nphp \"$DRUPAL_TI_DRUPAL_DIR/$DRUPAL_TI_MODULES_PATH/composer_manager/scripts/init.php\"\n\n# Ensure the module is linked into the code base and enabled.\n# Note: This function is re-entrant.\ndrupal_ti_ensure_module_linked\n\n# Update composer\ncd \"$DRUPAL_TI_DRUPAL_DIR\"\ncomposer drupal-rebuild\ncomposer install --prefer-source\n```\n\n### Contributions\n\nContributions are welcome.\n\n### Drush\n\nFor your convenience the `drush site-set` command is set for the Drupal installation, so any Drush commands triggered in your own scripts will be run against the test Drupal instance.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLionsAd%2Fdrupal_ti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLionsAd%2Fdrupal_ti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLionsAd%2Fdrupal_ti/lists"}