<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Levko Ivanchuk</title>
    <description>The latest articles on DEV Community by Levko Ivanchuk (@lewkoo).</description>
    <link>https://dev.to/lewkoo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F553171%2Ff53d933b-9f2b-4fec-85d3-7b28727c4b98.jpeg</url>
      <title>DEV Community: Levko Ivanchuk</title>
      <link>https://dev.to/lewkoo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lewkoo"/>
    <language>en</language>
    <item>
      <title>Re-usable and maintainable GitHub Action workflows for multiple repositories</title>
      <dc:creator>Levko Ivanchuk</dc:creator>
      <pubDate>Wed, 06 Jan 2021 11:14:44 +0000</pubDate>
      <link>https://dev.to/lewkoo/re-usable-and-maintainable-github-action-workflows-for-multiple-repositories-2egp</link>
      <guid>https://dev.to/lewkoo/re-usable-and-maintainable-github-action-workflows-for-multiple-repositories-2egp</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;UPD:&lt;/strong&gt; Since I wrote this post, GitHub has provided &lt;a href="https://github.blog/2022-02-10-using-reusable-workflows-github-actions/"&gt;a built-in approach for re-using workflows&lt;/a&gt;. Thanks to &lt;a href="https://github.com/msberends"&gt;msberends&lt;/a&gt; for pointing that out. Essentially this tutorial describes a composite action - and the article by GitHub linked above has a very good comparison table between reusable workflows and a composite action. However, I disagree that a composite action can not use secrets and if: conditionals - we have successfully injected secrets into our containers which executed our composite action and managed to have conditional steps inside our composite action.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;While I will talk about some project specifics, the CI/CD techniques I will outline in this post will be suitable to any individual/organization that maintains a set of GitHub repositories and wants to have a &lt;em&gt;single&lt;/em&gt;, &lt;em&gt;unified&lt;/em&gt; GitHub Actions workflow to test, build, validate and eventually release their binaries or whatever the end product of their work is. The only constants here are, basically: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub for repository hosting&lt;/li&gt;
&lt;li&gt;GitHub Actions for CI/CD&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it, everything else is optional/configurable/interchangeable, etc.&lt;/p&gt;

&lt;p&gt;This blog post also has a &lt;a href="https://github.com/lewkoo/reusable-gh-action-workflows"&gt;companion repo&lt;/a&gt;, showcasing some examples.  &lt;/p&gt;

&lt;p&gt;Also, a word of caution: these kinds of things - devops, CI/CD, etc. - aren't my specialty, more like a side job for winter holiday season when the rest of tasks slow down. So take everything you read with a grain of salt and I would welcome any comments/additions one might have.&lt;/p&gt;

&lt;p&gt;Let's dive in, shall we?&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;To give you some context, our GitHub organization maintains a lengthy list of private repositories, spanning all kinds of projects which, at some point, end up on some production systems, running either Ubuntu 16.04 (xenial) or Ubuntu 18.04 (bionic).&lt;/p&gt;

&lt;p&gt;A long time ago in a galaxy far far away, as naive as we were, we started with lengthy, manual commands to generate a Debian file and then some manual work to Slack/email it to a person directly in charge of said production hardware to install the updated package. Of course, the process was often repeated many times if there was a need to make a quick-fix kind of change &lt;em&gt;(I still have nightmares about this today)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then, by the time the Empire struck back, our team had dedicated a private server to distribute these Debian (.deb) files to the production hardware and other developers who depended on it. This was a good solution in terms of distribution, but the logistics of testing/building/uploading the file to the server were still in same stage of disrepair as the Millennium Falcon was in Episode 5 - flying, but without a hyperdrive. We needed and wanted a hyperdrive to escape the clutches of the &lt;del&gt;Empire&lt;/del&gt; &lt;em&gt;lots and lots&lt;/em&gt; of manual labour and asking people with SSH tunnel to the APT repository server to manually upload a new version of the Debian file. &lt;/p&gt;

&lt;p&gt;Finally, a Jedi returned and said Jedi bravely noticed a tab called &lt;em&gt;Actions&lt;/em&gt; on every repository. Thus, a new era has begun in the galaxy, an era which promised a bright future where all laborious, manual tasks will be automated and quick-fixes can be tested, build and delivered to the production hardware in minutes, not hours. Automatically. By computers, using magic, no less. &lt;/p&gt;

&lt;h2&gt;
  
  
  Naive Version 1
&lt;/h2&gt;

&lt;p&gt;As the developer was just a padavan learner of GitHub Actions, the first GitHub Action (&lt;code&gt;alias 'GHA' 'GitHub Action'&lt;/code&gt;) workflow was a collection of snippets from various tutorials and docs, trying to understand the ways of the GHA workflows. Essentially, it achieved this: &lt;br&gt;
&lt;em&gt;(note,&lt;/em&gt; 🤬 &lt;em&gt;denotes a source of fatal-error in this initial attempt. The amount of such emojis indicates the gravity of the error)&lt;/em&gt;  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up &lt;a href="https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix"&gt;strategy matrix&lt;/a&gt; to run on base-bones (🤬) Ubuntu 16.04 and 18.04 Docker containers.&lt;/li&gt;
&lt;li&gt;Configure locales (🤬)&lt;/li&gt;
&lt;li&gt;Install a &lt;em&gt;ton&lt;/em&gt; (🤬🤬🤬) of &lt;em&gt;basic&lt;/em&gt; dependency packages in the container. (we are talking &lt;code&gt;wget&lt;/code&gt; kind of stuff here) &lt;/li&gt;
&lt;li&gt;Upgrade &lt;em&gt;git&lt;/em&gt; (of all things) so that &lt;code&gt;actions/checkout&lt;/code&gt; would not default to REST API cloning method via a zip file and would actually create a &lt;code&gt;.git&lt;/code&gt; directory. &lt;em&gt;(I still have nightmares about this today)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Clone target repo (duh)&lt;/li&gt;
&lt;li&gt;Create a workspace (1/2 🤬)&lt;/li&gt;
&lt;li&gt;Clone repositories which are dependencies for the target repository&lt;/li&gt;
&lt;li&gt;Install/upgrade dependency packages&lt;/li&gt;
&lt;li&gt;Run tests&lt;/li&gt;
&lt;li&gt;Build Debian file&lt;/li&gt;
&lt;li&gt;Create release on GitHub, upload CHANGELOG to it&lt;/li&gt;
&lt;li&gt;Upload the Debian file to the APT repository server&lt;/li&gt;
&lt;li&gt;Trigger an update there&lt;/li&gt;
&lt;li&gt;Check if the Debian file installs of clean container&lt;/li&gt;
&lt;li&gt;Notify us in Slack&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This workflow &lt;em&gt;worked&lt;/em&gt; but it had these flaws:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Workflow file itself was long and hard to read&lt;/li&gt;
&lt;li&gt;Workflow performed &lt;em&gt;a lot&lt;/em&gt; of &lt;em&gt;repetitive&lt;/em&gt; steps on every run that had &lt;em&gt;nothing&lt;/em&gt; to do with the tasks it actually needs to do on every run.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While the things above are manageable or, at least, can be paid for by billable time, this GHA workflow failed on one crucial element:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A change is this workflow needed to be propagated across all repositories&lt;/em&gt; and then &lt;em&gt;tested on all of them individually&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;In short, it didn't achieve SPM, or Single Point of Maintenance.&lt;/p&gt;

&lt;p&gt;See the companion repo for a workflow where these mistakes are highlighted.&lt;/p&gt;
&lt;h2&gt;
  
  
  Version 2
&lt;/h2&gt;

&lt;p&gt;Let's briefly summarize the fatal-errors of the version 1:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Duplicate container configuration steps&lt;/li&gt;
&lt;li&gt;Long, unreadable workflow file&lt;/li&gt;
&lt;li&gt;Workflow duplication across many repositories&lt;/li&gt;
&lt;li&gt;Difficult to change/update/upgrade in the future.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before discussing our solution, I would like to talk about a potential solution which we rejected but it might fit into some use cases.&lt;/p&gt;
&lt;h3&gt;
  
  
  Rejected idea: Workflows as submodule
&lt;/h3&gt;

&lt;p&gt;One idea we had is to place our single workflow file into a new repository and register it as a submodule in all our production repositories.&lt;/p&gt;

&lt;p&gt;This would give us SPM, or Single Point of Maintenance, but it would also come with limitations. &lt;/p&gt;

&lt;p&gt;While it is true that most build and release tasks are identical across all repositories, there are cases where steps are either skipped or performed in a slightly different way. &lt;/p&gt;

&lt;p&gt;Just having a single workflow file will limit us it terms of workflow customization with respect to the needs of every individual repo. For example, some repos do not have tests so they can skip that step.&lt;/p&gt;

&lt;p&gt;Furthermore, we will not be able to add custom workflow steps which relate only to a single repo.&lt;/p&gt;

&lt;p&gt;Thus, our solution was two fold:&lt;/p&gt;

&lt;p&gt;1) Use of custom Docker images and&lt;br&gt;
2) Use of a custom GitHub Action&lt;/p&gt;
&lt;h2&gt;
  
  
  Docker Images: pre-baked build environment
&lt;/h2&gt;

&lt;p&gt;We were already using Docker support built into GitHub Actions with its &lt;a href="https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer"&gt;container&lt;/a&gt; directive as we needed to build for two (and, in the future, potentially more) systems, but our Version 1 workflow used bare-bones &lt;code&gt;ubuntu&lt;/code&gt; images and needed to install a lot of dependencies on every workflow run.&lt;/p&gt;

&lt;p&gt;Fortunately, performance penalty was relatively low - around 20 seconds of repeated billable time for every run for every repository. However, the main issue was the lack of SPM - if we needed to add a new dependency package we would need to visit every repository with this change.&lt;/p&gt;

&lt;p&gt;Here is a snippet of some example steps which can and should be refactored into a custom docker image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This step installs some basic dependency packages which are needed down the line&lt;/span&gt;
&lt;span class="c1"&gt;# They should be installed when building a docker image&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Update git &amp;amp; install additional dependencies&lt;/span&gt;
&lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
    &lt;span class="s"&gt;# Update package cache&lt;/span&gt;
    &lt;span class="s"&gt;apt-get update&lt;/span&gt;
    &lt;span class="s"&gt;# Install build agent and some other packages&lt;/span&gt;
    &lt;span class="s"&gt;apt-get install -yq software-properties-common apt-utils debhelper build-essential wget&lt;/span&gt;
    &lt;span class="s"&gt;# Upgrade git&lt;/span&gt;
    &lt;span class="s"&gt;add-apt-repository -y -u ppa:git-core/ppa&lt;/span&gt;
    &lt;span class="s"&gt;# Upgrade git&lt;/span&gt;
    &lt;span class="s"&gt;apt-get install -yq git&lt;/span&gt;
&lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See &lt;code&gt;repeated_conf_steps.yml&lt;/code&gt; in the companion repo for an example workflow.&lt;/p&gt;

&lt;p&gt;Our solution was to create a new repo with our custom Docker images.&lt;br&gt;
We then migrated &lt;em&gt;all&lt;/em&gt; such configuration/install steps into a single &lt;code&gt;Dockerfile&lt;/code&gt;, setting the ubuntu distro as an argument, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;ARG&lt;/span&gt;&lt;span class="s"&gt; _DISTRO&lt;/span&gt;
&lt;span class="c"&gt;# Base off the basic ubuntu images&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; ubuntu:$_DISTRO&lt;/span&gt;
&lt;span class="c"&gt;# Install required packages and upgrade git&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;dpkg-reconfigure debconf &lt;span class="nt"&gt;--frontend&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;noninteractive &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="se"&gt;\ &lt;/span&gt;
    apt-get update &amp;amp;&amp;amp; \ 
    apt-get install -yq --no-install-recommends software-properties-common apt-utils debhelper build-essential wget &amp;amp;&amp;amp; \
    add-apt-repository -y -u ppa:git-core/ppa &amp;amp;&amp;amp; \
    apt-get install -yq git &amp;amp;&amp;amp; \
    rm -rf /var/lib/apt/lists/* &amp;amp;&amp;amp; \
    apt-get purge --auto-remove &amp;amp;&amp;amp; \
    apt-get clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We then built and published these images to our private account on &lt;a href="https://docs.github.com/en/free-pro-team@latest/packages/guides/about-github-container-registry"&gt;Github container registry, or GHCR for short&lt;/a&gt;. You can, of course, use any other registry.&lt;/p&gt;

&lt;p&gt;Maintaining these Docker images is easy and we also added a workflow to build and publish them to the registry, &lt;a href="https://docs.docker.com/ci-cd/github-actions/"&gt;based off this example&lt;/a&gt;. Any change to Docker images gets build and released in minutes and is therefore immediately available to all workflows that run on updated containers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note on self-hosted runners&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Combined with self-hosted runners and local Docker cache, you get a near-instant container initialization bonus, so that's nice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note on secret data&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We &lt;em&gt;did not&lt;/em&gt; store any sensitive/private data inside these container images, even though they were stored in a &lt;em&gt;private&lt;/em&gt; container registry.&lt;/p&gt;

&lt;p&gt;All secret data was loaded into container upon startup by the workflow itself. Before you say "but that isn't SPM" - and you'd be right - secret data isn't something that gets added frequently, so we included as many things as we could think of, even if some of them aren't used now.&lt;/p&gt;

&lt;p&gt;To store our secrets we used GitHub's secrets features on the organization level. This is a great option because we can update a secret value (say, PAT value changes at some point) and that would propagate to all repositories managed by our organization.&lt;/p&gt;

&lt;p&gt;Secrets were loaded as pain environment values to be used inside a container later, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;container&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# ...&lt;/span&gt;
    &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;GH_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GH_USER }}&lt;/span&gt;
        &lt;span class="na"&gt;GH_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GH_TOKEN }}&lt;/span&gt;
    &lt;span class="c1"&gt;# ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Custom GitHub Action: refactoring common workflow steps
&lt;/h2&gt;

&lt;p&gt;With pre-build install and configure steps pre-baked into a Docker image and out of the way, we were ready to implement workflow steps which are actually unique for every workflow run.&lt;/p&gt;

&lt;p&gt;However, we needed to refactor them into a single place, preferably another repository, where we could maintain these steps. &lt;a href="https://blog.marcnuri.com/triggering-github-actions-across-different-repositories/"&gt;While it is possible to trigger one workflow from another&lt;/a&gt;, we chose instead to use a &lt;a href="https://docs.github.com/en/free-pro%24%24-team@latest/actions/creating-actions"&gt;custom GitHub Action&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First hurdle we needed to overcome was to store this custom action in a &lt;em&gt;private repository&lt;/em&gt; and still be able to use it. GitHub does not provide an explicit way of doing this, but it can be easily achieved with a &lt;code&gt;checkout&lt;/code&gt; step, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Checkout the repo being built&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
&lt;span class="c1"&gt;# Checkout the action repo&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
    &lt;span class="s"&gt;with&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;repository&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;example-org-name/custom-action&lt;/span&gt;
        &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GH_TOKEN }}&lt;/span&gt;
        &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.github/actions/custom-action&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this simple step, custom private action can be run. GitHub Actions supports three types of custom actions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Docker container action&lt;/li&gt;
&lt;li&gt;JavaScript action&lt;/li&gt;
&lt;li&gt;Composite run steps action&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Exact type to use would depend on your needs. Since we needed to run a whole bunch of &lt;code&gt;bash&lt;/code&gt; commands and we were already inside a configured Docker container, we chose a composite run steps action.&lt;/p&gt;

&lt;p&gt;Composite run steps action is a fancy way of saying that it runs bash commands in order, with the ability to have inputs and outputs. This last ability - I/O - was crucial to us. I won't and I can't go into details of the actual implementations, but we ended up with a custom action that could be used in a workflow like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Run the action according to the configuration&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Perform&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;common&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;steps'&lt;/span&gt;
  &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./.github/actions/custom-action&lt;/span&gt;
  &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;custom-action&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;step_1&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;step_2&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;step_3&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;step_4&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each and every repository in our organization can pick and choose what steps it needs to execute and even under what conditions. For example, we might not want to run &lt;code&gt;step_3&lt;/code&gt; on &lt;code&gt;feature&lt;/code&gt; branches, but it is a must for all &lt;code&gt;release&lt;/code&gt; branches.&lt;/p&gt;

&lt;p&gt;Outputs of this action contained a JSON with results for each step. This data was then used for notifying us about anything that we want to know about regarding our workflow runs - although our notification procedures were also refactored into this custom action as just another step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;With the optimizations and refactoring described above, we have achieved quite a few improvements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Workflow files inside repositories were reduced from ~400 lines to ~40.&lt;/li&gt;
&lt;li&gt;We achieved same work with less time - some builds with lengthy tests were reduced from 30 - 40 minutes to just 10.&lt;/li&gt;
&lt;li&gt;We have a drop-in workflow file, interchangeable with all our repositories but still configurable if we need to add / remove some steps.&lt;/li&gt;
&lt;li&gt;In addition to pre-building our own custom Docker containers, we ended up with, well, our own Docker containers containing a minimum setup which we can use later for other needs, like, running our code on production hardware inside Docker.&lt;/li&gt;
&lt;li&gt;We achieved Single Point of Maintenance of almost all of our workflow actions - we can modify either a Docker image if we need to pre-install/configure something or a custom action itself if we need to change the behavior of the workflow.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Acknowledgements
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/logos"&gt;GitHub logo&lt;/a&gt; is used as allowed by GitHub - &lt;code&gt;Use the Octocat or GitHub logo in a blog post or news article about GitHub&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devops</category>
      <category>docker</category>
      <category>github</category>
    </item>
  </channel>
</rss>
