<p><a href="/daily/2022/08/15/using-run-file-simplify-project-tasks">One of my earliest daily emails was about <code>run</code> files</a> - files that contain Bash functions that combine or simplify project-specific tasks.</p>
<p>In Drupal projects, these could be to execute Composer or Drush commands, connect to the database, or run automated tests.</p>
<p>For my CI pipelines, I like to use a function called <code>ci:test</code> that contains all the commands to run in the pipeline.</p>
<p>This keeps the pipeline configuration as simple and agnostic as possible.</p>
<p>It also makes it easy for people to read and, because it's a bash file, it will run anywhere without any additional tools.</p>
<p>For an example, <a href="https://github.com/opdavies/docker-example-drupal/blob/d18bf2242fba1291cabf1e16a5badb6fda7ce509/run#L16-L35">see my Drupal Docker example repository</a>.</p>
<h2 id="here%27s-the-thing">Here's the thing</h2>
<p>The main advantage, though, is being able to run the pipeline locally, if you need to.</p>
<p>Maybe you need to debug a failure in the pipeline or you want to test a change to the pipeline locally before pushing it.</p>
<p>By using a command in a <code>run</code> file, doing so is as simple as running that one command.</p>
<p><a href="/daily/2022/08/15/using-run-file-simplify-project-tasks">One of my earliest daily emails was about <code>run</code> files</a> - files that contain Bash functions that combine or simplify project-specific tasks.</p>
<p>In Drupal projects, these could be to execute Composer or Drush commands, connect to the database, or run automated tests.</p>
<p>For my CI pipelines, I like to use a function called <code>ci:test</code> that contains all the commands to run in the pipeline.</p>
<p>This keeps the pipeline configuration as simple and agnostic as possible.</p>
<p>It also makes it easy for people to read and, because it's a bash file, it will run anywhere without any additional tools.</p>
<p>For an example, <a href="https://github.com/opdavies/docker-example-drupal/blob/d18bf2242fba1291cabf1e16a5badb6fda7ce509/run#L16-L35">see my Drupal Docker example repository</a>.</p>
<h2 id="here%27s-the-thing">Here's the thing</h2>
<p>The main advantage, though, is being able to run the pipeline locally, if you need to.</p>
<p>Maybe you need to debug a failure in the pipeline or you want to test a change to the pipeline locally before pushing it.</p>
<p>By using a command in a <code>run</code> file, doing so is as simple as running that one command.</p>