<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sergio Freire on Medium]]></title>
        <description><![CDATA[Stories by Sergio Freire on Medium]]></description>
        <link>https://medium.com/@darktelecom?source=rss-1fba983cb0ba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*e96j2HluiyJg8RHq.png</url>
            <title>Stories by Sergio Freire on Medium</title>
            <link>https://medium.com/@darktelecom?source=rss-1fba983cb0ba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 03:15:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@darktelecom/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Improving Testing through Testing Debt Quadrants]]></title>
            <link>https://medium.com/@darktelecom/improving-testing-through-testing-debt-quadrants-10aa1226d661?source=rss-1fba983cb0ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/10aa1226d661</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Sergio Freire]]></dc:creator>
            <pubDate>Tue, 07 Apr 2020 11:10:05 GMT</pubDate>
            <atom:updated>2020-04-07T11:10:05.473Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="improving testing" src="https://cdn-images-1.medium.com/max/656/1*U56Uf5EqkkKV3opl0HJPqg.png" /></figure><p>I was lucky to attend Euro Testing Conference 2020, in Amsterdam, last month; I learned <a href="https://www.sergiofreire.com/post/european-testing-conference-my-first-and-last-experience-and-my-takeaways">so much</a>.</p><p>One of the workshops that I attended was <a href="https://twitter.com/RobMeaney">Rob Meaney</a>’s “<a href="https://europeantestingconference.eu/2020/topics/#rob-meaney">Exploring Testability</a>” which inspired me to try something within my team.</p><p>At the conference, we did a hands-on exercise related to testing debt. Testing what?! Debt!</p><p>This article will explain the <strong>testing debt concept</strong>, how to make it visible and how to address it.</p><h3>What is testing debt?</h3><p>We all heard about the technical debt concept before — the development decisions made to provide benefits in the short-term that will, however, inhibit benefits in the future; in other words, imagine doing a quick “hack” to provide a feature instead of properly choosing the right architecture to support it. Testing debt is similar.</p><p>Quoting Rob:</p><blockquote><em>Testing debt occurs when a team intentionally or unintentionally chooses an option that yields benefit in the short term but results in accrued testing cost in terms of time, effort or risk in the longer term.</em></blockquote><p><a href="https://twitter.com/pvarhol">Peter Varhol</a>, <a href="https://www.slideshare.net/pvarhol/identifying-and-measuring-testing-debt">puts it slightly differently</a>:</p><blockquote><em>The effort needed to find and fix issues that remain in the code when an application is released.</em></blockquote><p>In simple words: <strong>testing debt is all about the testing that you should have done but for some reason,</strong> you didn’t.</p><h3>Testing Debt Quadrants</h3><p>During Rob’s workshop, we mapped our debt using Testing Debt Quadrants.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jI3A8sdRCpGkHn56I_GUFQ.png" /></figure><p><strong>The testing debt quadrants provide a way to visualize debt, including</strong>:</p><ol><li>untested things</li><li>testing that is slow or impractical and that can lead it to be forgotten/not performed</li><li>items/components that are complex to test</li><li>items you cannot rely on</li></ol><p><strong>Therefore, we split the cardboard into 4 sections:</strong></p><ol><li>impossible/impractical</li><li>slow</li><li>complex</li><li>untrustworthy</li></ol><blockquote><em>Note: instead of seeing all of the above as problems, they are in fact opportunities.</em></blockquote><p>The process starts by adding post-its, identifying a “piece of debt” (i.e. something that we are not testing thoroughly or the way we should).</p><p>As a team, we identify the most relevant ones (i.e. the ones that contribute the most to the testing debt). For each one of these, we discuss possible ways of addressing them and add them to new post-its. And now we have concrete actions that we can take to reduce our debt and improve the overall testing.</p><h3>From theory to practice: how we did it?</h3><p>After the conference, I wanted to try this exercise internally and see if it was valuable or not. I also wanted to make visible some pain-points on our testing process.</p><p>We did this with a small group, including myself, part of our testers and also the team lead. Even though my role was essentially a facilitator, as I’ve been the product owner of the product we are testing, I do have particular insights about it which I cannot neglect :)</p><p>We started by doing a <a href="https://www.xpand-it.com/pt-pt/2019/12/26/metodologias-ageis-cinco-licoes-a-partir-do-coaching-a-diferentes-equipas/">retrospective </a>on our current development &amp; testing process. By drawing it, we could easily see who was doing what and when. It also allowed us to depict some improvement opportunities right away.</p><p>I see this kind of diagrams as starting points for discussion; some care should be taken though, or else this can lead to long discussions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G80dA9kGh3Nx53XS5Vo9fw.jpeg" /></figure><p>We then moved to the Testing Debt Quadrants and starting writing and adding post-its to the 4 quadrants. Each one did this alone and in the end, we could see some overlap (which I’d say it is “normal” to happen).</p><p>Where we position each post-it in the cardboard is somehow subjective; however, as we reviewed the whole cardboard, we move some of them and agreed on it. Note that, for example, some items can be slow and complex at the same time. Where the post-its end up doesn’t need to be scientific; use “positioning” as a means for further discussion/insights.</p><p>We saw that we had some unfinished work that could tackle some of the identified problems. We just need to turn that into reality.</p><figure><img alt="testing debt quadrants post-its" src="https://cdn-images-1.medium.com/max/1024/1*638_lCScNI0c5Xda_aUUYQ.png" /></figure><h3>From discovery to actions</h3><p>Having discovered and discussed part of the items that contribute to our testing debt, it’s important to have actionable, prioritized items.</p><p>Thus, we decided to create a very simple Trello board to track their implementation and/or discuss anything around them.</p><p>It’s interesting that as per our initial discussion during the “visual mapping” of our development/testing process, we could depict some opportunities to improve testing considerably. Thus, the board contained actions not only found during the Testing Debt Quadrants but also from the initial sketch we did about our overall process.</p><figure><img alt="Trello board" src="https://cdn-images-1.medium.com/max/1024/1*W4iVYb9udKlCefs1va__EQ.png" /></figure><h3>Things to have in mind</h3><p>Whenever looking at its full extent, it’s easy to get lost and start discussing a ton of different topics.</p><p>Some recommendations for us and anyone trying it out:</p><ul><li>timebox it, so we don’t extend it endlessly</li><li>focus (no interruptions)</li><li>involve other roles</li><li>think on improving gradually, a step at a time (this will avoid finding the “perfect solution”)</li><li>revisit the cardboard regularly</li></ul><p>I would also recommend having the conversations in such a way where there is no pinpointing. This should be a team exercise, open but not individual-focused.</p><h3>And now what?</h3><p>I think mapping your testing issues, which are also opportunities to improve your overall <a href="https://www.xpand-it.com/pt-pt/atlassian/">testing process</a>, using Testing Debt Quadrants is a simple and valuable exercise.</p><p>All the conversations you have are important to have a joint overview of how testing is being addressed and how it can be improved.</p><p>Just make sure that these conversations aren’t pointless and, instead, lead to actions that you can track and revisit together somehow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10aa1226d661" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mob Learning and Testing]]></title>
            <link>https://medium.com/@darktelecom/mob-learning-and-testing-4696bb16b1ee?source=rss-1fba983cb0ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/4696bb16b1ee</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[mob]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Sergio Freire]]></dc:creator>
            <pubDate>Wed, 13 Nov 2019 14:34:17 GMT</pubDate>
            <atom:updated>2019-11-13T14:34:17.753Z</atom:updated>
            <content:encoded><![CDATA[<p>After attending <a href="https://agiletestingdays.com/2019/program">Agile Testing Days (ATD) 2019</a> it became (even more) clear to me that learning is a trip with better outcomes whenever doing it with someone else in a proactive way. Alone we can do great things; however, we can go farther together.</p><p>For me, this where Mob Learning comes to play.</p><p>It’s not about learning in a random, unfocused group. First, it’s a group of people with an ultimate shared goal: they want to learn and improve their skills.</p><p>For this, they need to have some sort of structure:</p><ul><li>Be committed</li><li>Be present, i.e. available to and for others</li><li>Be open and humble</li><li>Understand that “truth changes”</li></ul><p>Learning is a process, an inner one. I’m not an expert in that area but what I’ve seen is that it’s a shared process. We learn with our experiences but also with the experiences of others. We listen and try to understand different points-of-view, so we can refine our own.</p><p>But, first of all, it’s important to understand where we come from.</p><p>During Agile Testing Days 2019, one afternoon, a group of attendees took a walk and discussed several topics namely the challenges organizations face. At that time, I remembered a workshop I had weeks ago at Agile Connect Aveiro: “Agile <a href="https://mailchi.mp/humanmngt/mngtbug">MngtBugs</a> &amp; MngtFixes” by <a href="https://twitter.com/espinheirae">Eduardo Espinheira</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*faLE04bfMgMdqvokcua6zg.png" /></figure><p>Explaining it briefly: the idea behind that concept is that you can actually sum up problems/”bugs” because they’re common between organizations. And you know what? solutions/”fixes” are also common.</p><p>There’s more than this but what I wanted you to have in mind is that we are not alone; our problems are common or typical, and our solutions are also common or typical.</p><p>In our brief discussion during this walk, I remember saying “for similar problems we may apply similar solutions”. And “similar” is key here; nothing is alike; that also means that we cannot apply solutions blindly. We need to understand the context and what lies behind the problems and solutions we have in our hands.</p><p>That’s why solving problems together is easier than alone: because we can make things visible, share, discuss, target and overcome. And each one brings his/her own experience to the table, challenging our own fears and our own beliefs.</p><p>The <a href="https://www.slideshare.net/lisihocke/i-cant-do-this-alone-a-tale-of-two-learning-partners-agile-testing-days-2019">final keynote of Lisi Hocke and Toyer Mamoojee</a> showed precisely this: they started mostly alone, having their own fears but they teamed together and committed to each other and that made them reach much farther, in a consistent way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*aTU5GcJhy49XV_v1LrFiXg.png" /></figure><p>They could vocalize their thoughts, discuss them and give feedback based on their shared experiences.</p><p>Each one of us is a bag of experiences; sometimes we make it hard to realize it. Our different backgrounds give us different perspectives.</p><p>Are they better? They’re different for sure and they complement what we already know.</p><p>We may reinforce, re-question or discard what we know. And “truth” changes with time. “Agile”, remember? There are no written truths in stone.</p><p>With time, <a href="https://twitter.com/lisihocke">Lisi</a> and <a href="https://twitter.com/tottiLFC">Toyer</a> pair evolved into a group, a Power Learning Group where they could support each other, share ideas and collaborate.</p><blockquote>By collaborating, as equals, we can improve our knowledge. Each one of us has a different background, different expertise levels in different things. Yet, every single one of us has their own vision of the world.</blockquote><p><strong>Knowledge grows at a faster pace whenever it is fostered, facilitated and shared.</strong></p><p>An excellent tester has a swiss-knife of skills.</p><p>As <a href="https://twitter.com/dsynadinos">Damian Synadinos</a> mentioned in his keynote at ATD, we are not <a href="http://irisclasson.com/2013/07/08/stupid-question-218-what-are-t-shaped-pi-shaped-and-comb-shaped-skills-and-which-one-should-i-aim-for/">T shaped nor pi shaped</a>; each one of us is like a unique comb composed of a different set of skills, having different levels. If we complement each one’s comb with one another, we can ultimately obtain a more perfect comb.</p><figure><img alt="comb-shaped skilled person" src="https://cdn-images-1.medium.com/max/974/1*g5EuLCjce1t_AY9YxalAtA.png" /></figure><p>If we look at pair programming, or ultimately at mob programming, there are teams having great results with it as they work together around a common goal by complementing each one skills. The same happening with testing.</p><p>So, why not extend it to learning? To my own learning… to your own learning?</p><p>Sometimes it may be out of our own comfort zone: it’s hard to get away from there. But if we don’t do it, our progress will be limited. A way of overcoming it, similar to our own daily problems, is to talk about it. Also, recognize our own gaps.</p><p>Mob Learning is, in fact, a powerful way of learning.</p><p>Coming back to the previous “comb” example, the dynamic of learning in a group has similar characteristics: everyone contributes in their own way, based on their context, with bits and pieces, that stack up together building a unique fingerprint of our comb of knowledge (or “learning narrative” as <a href="https://twitter.com/jrosaproenca">João Proença</a> calls it). And this is only possible in a group that actively aims to improve.</p><p>Thus, we’re talking about learning with a goal and commitment, using multiple-perspectives and feedback to help you grow. It’s more than learning with a group of people, or with someone else; it’s about a continuous way of learning around a common goal, through perseverance, sharing and challenging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*zfPTuNRUbgQGj-p7TSijJA.png" /></figure><p>Now that I’m more aware of it, I’ll do my best to put it in practice. It may not be easy to give the first step but you know what? I think it is worth it!</p><p>We can start with small things: how we approach a conference? Are we there to attend or to be part of it? Are we inspiring ourselves with what we hear and see? As an example, whenever I saw <a href="https://twitter.com/a_bangser">Abby Bangser</a>’s keynote (<a href="https://www.slideshare.net/AbigailBangser/empowerment-through-observability-keynote-191083575">slides</a>) on “observability” that made me think about our own cloud-based product and how we can leverage what we have to have true observability, so we can analyze the system in a dynamic way and answer non-predetermined questions. We may have logs, we may have metrics but it’s not enough and now I understand why: we cannot predict what we need to know.</p><p>Remember that if we’re aiming to be more Agile, we need to improve, continuously.</p><p>We can read, we can observe, we can listen, we can share, we can try, we can challenge, we can overcome, we can learn.</p><p>And yes, we can mob learn together. It seems to make perfect sense when it comes to Testing, doesn’t it? So many challenges, so many doubts, so many ideas, so many that we can learn from.</p><p>Mob Learning and Testing, two close friends, for sure!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4696bb16b1ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Actions: powering up your existing repos with build capabilities]]></title>
            <link>https://medium.com/@darktelecom/github-actions-powering-up-your-existing-repos-with-build-capabilities-1636b065b823?source=rss-1fba983cb0ba------2</link>
            <guid isPermaLink="false">https://medium.com/p/1636b065b823</guid>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Sergio Freire]]></dc:creator>
            <pubDate>Tue, 24 Sep 2019 14:52:17 GMT</pubDate>
            <atom:updated>2019-09-24T14:52:17.098Z</atom:updated>
            <content:encoded><![CDATA[<p>I was lucky enough to enter the beta program for <a href="https://github.com/features/actions">GitHub Actions</a>.</p><p>Throughout this article, I’ll give you an overview of my findings of “GitHub Actions”, core concepts and some examples.</p><h3>What is it and what can it be used for?</h3><p>GitHub Actions are used to<em> “build an automated software development lifecycle workflow” (GitHub).</em></p><p>GitHub Actions are somehow a response from GitHub to competitors (e.g. BitBucket, Jenkins, CircleCI) that enable powerful build processes and CI/CD by using a descriptive syntax managed as a YAML file stored in the repository, alongside with code.</p><p>Thus, you can use it to compile, lint, test, package, deploy your software. You can do whatever you want and fine-tune your build to your needs. GitHub provides an infrastructure where jobs will run. But more than that: it provides a <a href="https://github.com/marketplace?type=actions">marketplace</a> where “actions” can be published and freely be referenced and reused in your workflows.</p><p>Thus, you and the community can create these building blocks called “actions” and make them available for others, so you can stay focused on what matters. Examples of these actions would be: setup a specific Java version for the whole build process, publish a Ruby gem or a maven artifact, lint Javascript code, analyze the code coverage, do a security scan, etc.</p><p>But even if you don’t want to, you can keep your actions private and use them internally within your repositories.</p><h3>In a nutshell</h3><p>Workflows are defined as YAML files inside .<em>github/workflows</em> directory. Multiple workflows can coexist and run simultaneously.</p><p>Add description</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WNfLp5v-Pat8o-Nf" /></figure><p>To see the runs for your workflows (i.e. workflow runs), you may access Actions tab in your repository browser.</p><p>Add description</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wj62nomDrht8gV34" /></figure><p>Add description</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aQhjHBAeZWUSv7Im" /></figure><h3>Characteristics</h3><ul><li>Multiple workflows for the same repository are supported</li><li>Run jobs from one workflow sequentially or in parallel</li><li>Steps can be implemented as native commands or “actions”, which in turn may be NodeJS scripts or docker containers</li><li>Docker-based actions don’t need to have the respective images published (e.g. on Docker Hub); you may simply define the Dockerfile, in the repository, which will be used to build the image on-the-fly, whenever the action is called</li></ul><h3>Similar technologies</h3><p>GitHub Actions have some similarities with <a href="https://bitbucket.org/product/features/pipelines">Bitbucket Pipelines</a>, <a href="https://jenkins.io/doc/book/pipeline/">Jenkins Pipelines</a> and <a href="https://circleci.com/docs/2.0/about-circleci/#section=welcome">CircleCI</a> way of configuring builds. However, in this article, we’ll not dive into that.</p><h3>Key concepts</h3><h3>Virtual environment</h3><p>A virtual machine (Windows, Ubuntu, macOS) with a set of tools preinstalled where workflows will run. More info <a href="https://help.github.com/en/articles/virtual-environments-for-github-actions">here</a>.</p><h3>Workflow</h3><p>An automated process defined at the repository level, triggered upon a specific event or scheduled; an example would be a full CI/CD pipeline</p><ul><li>A workflow is composed of one or more jobs, which in turn are composed of steps implemented as commands or actions</li><li>Workflows run in the virtual environment</li></ul><p>More info <a href="https://help.github.com/en/articles/configuring-a-workflow">here</a>.</p><h3>Workflow run</h3><p>A running instance of the workflow.</p><h3>Context</h3><p>The context (i.e. temporary information/data) of the workflow run, including virtual environment, jobs, steps.</p><p>More info <a href="https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#contexts">here</a>.</p><h3>Job</h3><p>A task made of steps.</p><ul><li>Jobs may run on parallel or sequentially, depending on the previous job result</li><li>All steps in job are executed in the same virtual environment instance, sharing the same filesystem</li></ul><h3>Step</h3><p>A specific command run directly/explicitly or a call to a pre-built runnable code, called action (i.e. a command or an action)</p><h3>Action</h3><p>A reusable and pre-built runnable code (e.g. checkout code, code coverage analysis, security scan), either as a Docker container or a javascript script.</p><ul><li>Docker container actions are limited to Linux based virtual environments</li><li>Can be stored locally, in the working code repository, or can be stored in a different repository</li><li>Can be versioned and distributed in Github Marketplace, as long as they’re in a public repository</li><li>Can receive parameters, with values hardcoded or obtained from GitHub secrets</li></ul><p>More info <a href="https://help.github.com/en/articles/about-actions">here</a>.</p><h3>How does it work?</h3><p>A user working in the GitHub repository defines a workflow by creating a file under .<em>github/workflows.</em> Multiple workflows may be defined.</p><p>A workflow defines this high-level process you want to run, like a traditional build composed of compile, test, package targets, upon a specific event such a code commit.</p><p>Upon the specific trigger defined in the workflow, or due to a pre-defined schedule also definable in the workflow, it will run. This will create a “workflow run”. Jobs defined in the workflow can run sequentially or in parallel, depending on the configuration.</p><p>Each job uses a clean virtual environment, where all steps will be executed on. Information can be shared between steps, either by using the file system or by accessing information produced by the step (e.g. the standard output). Environment variables can also be changed between steps, although I’ve not tried it out.</p><p>A step can run directly on the virtual environment or as a Docker container having access to the shared file system.</p><p>Logs from the workflow run can be accessed in the “Actions” tab in the repository.</p><h3>Examples</h3><p>The following examples are quite basic. The idea is to understand core concepts and how to evolve from a simple example to some a bit more evolved yet still very basic.</p><p>The examples may be found in <a href="https://github.com/bitcoder/github-actions-exps">this</a> public repository.</p><h3>Example 1a: Hello, world!</h3><p>In this example, we’ll create a very basic workflow that prints “Hello, world!” to the console/stdout. It uses the Linux, Ubuntu-based virtual environment. It runs the “echo” command directly on that environment.</p><p>This example is triggered upon a push/code commit. The file is stored in the repository as .<em>github/workflows/example1a.yml</em>. The name of the workflow file is irrelevant but it would make sense to have the same name as the value for “name” field defined within the workflow file.</p><pre>name: example1a<br></pre><pre>on: [push]<br></pre><pre>jobs:<br>  build:	<br>    runs-on: ubuntu-latest<br>    <br>    steps:<br>    - name: Run a one-line script<br>   <br>      run: echo Hello, world!</pre><h3>Example 2a: using environment variables as parameters</h3><p>In this evolved example, we will pass the message as an environment variable named “MESSAGE” to the command we want to run (“echo” in our example).</p><pre>name: example2a<br></pre><pre>on: [push]<br></pre><pre>jobs:<br>  build:<br>    runs-on: ubuntu-latest<br>    <br>    steps:<br>    - name: Run a one-line script<br>      env:<br>        MESSAGE: Hello, world2!<br>     <br>      run: echo $MESSAGE</pre><p>Using environment variables is common in this kind of approaches.</p><h3>Example 3a: Docker-based action and a public image, overriding entrypoint, and arguments</h3><p>In this example, we will use a public Docker image to be called, after it is instantiated as a contained, from a step. We can call just mention the container and GitHub will use the entrypoint defined in the Docker image. However, you may also override it. You may also enforce the arguments given to the entrypoint defined executable.</p><pre>name: example3a</pre><pre>on: [push]</pre><pre>jobs:<br>  build:<br>    runs-on: ubuntu-latest<br>    <br>    steps:<br>    - name: Run a one-line script<br>      uses: docker://alpine:latest<br>      with:<br>        entrypoint: /bin/echo<br>       <br>        args: Hello, world3!</pre><p>Add description</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pjBB20nsBxu84sEI" /></figure><h3>Example 3b: local Docker-based action, overriding entrypoint, and arguments</h3><p>In this example will define an action locally, in our code repository, and mention it in our workflow. For that, we just need to provide the path.</p><pre>name: example3b<br></pre><pre>on: [push]<br></pre><pre>jobs:<br>  build:<br>    runs-on: ubuntu-latest<br>    <br>    steps:<br>    - uses: actions/checkout@v1<br>    - name: Run a one-line script<br>      uses: ./.github/actions/blabla<br>      with:<br>        entrypoint: /bin/echo<br>        args: Hello, world3b!</pre><p>The action is implemented using Docker; you need to define the respective Dockerfile (see below) and GitHub will build the image whenever the workflow runs.</p><p><em>.github/actions/blabla/Dockerfile</em></p><pre>FROM debian:9.5-slim<br>	</pre><pre>ENTRYPOINT [&quot;/bin/echo&quot;]</pre><h3>Example 3c: local Docker-based action, using input variables</h3><p>There are several ways of passing arguments/additional information to steps. Input parameters are available for Docker-based actions.</p><p>This example uses a locally defined Docker-based action. The action receives two input variables: “name” and “message”.</p><pre>name: example3c</pre><pre>on: [push]</pre><pre>jobs:<br>  build:<br>    runs-on: ubuntu-latest<br>    <br>    steps:<br>    - uses: actions/checkout@v1<br>    - name: Run a one-line script<br>      uses: ./.github/actions/say-hi<br>      with:<br>        name: Sergio<br>        <br>        message: How are you?</pre><p>The action specification is done in the actual Dockerfile, which in this case resides in the local repository within <em>.github/actions</em> folder (i.e. <em>.github/actions/say-hi/Dockerfile</em>).</p><p>During the workflow run, the image is automatically built and a container is created.</p><pre>FROM debian:9.5-slim</pre><pre>ADD entrypoint.sh /entrypoint.sh<br>RUN chmod +x /entrypoint.sh</pre><pre>ENTRYPOINT [&quot;/entrypoint.sh&quot;]</pre><p>The Docker image uses an auxiliary script that implements the logic itself; in this case, it’s just an executable that calls “echo” and prints two environment variables. Note that the input variables defined in the workflow are “translated” to environment variables using the syntax “INPUT_&lt;variable_in_uppercase&gt;”.</p><pre>#!/bin/sh -l<br>/bin/echo &quot;$INPUT_NAME: $INPUT_MESSAGE&quot;</pre><h3>Example 3d: passing a secret as an environment variable</h3><p>In this example, we start by defining a secret variable in the repository’ settings.</p><p>Add description</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_ZkYvIl0Dcks0-WE" /></figure><p>You may then reference it using contexts (e.g. ${{ secrets.SECRET_MESSAGE }}).</p><pre>name: example3d</pre><pre>on: [push]</pre><pre>jobs:<br>  build:<br>    runs-on: ubuntu-latest<br>    <br>    steps:<br>    - name: Run a one-line script<br>      env:<br>        MESSAGE: ${{ secrets.SECRET_MESSAGE }}<br>      run: echo $MESSAGE</pre><p>Note that if you try to print a secret to the logs, GitHub automatically redacts it. More info on using secrets <a href="https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables">here</a>.</p><h3>Real-life like example: Build a java/maven based project (compile, test)</h3><p>In this example, we’re building a Java, maven based project.</p><p>We’ll use the “<a href="https://github.com/actions/checkout">actions/checkout</a>” action to checkout the code from our repository to the virtual environment. This action is one of the “standard” actions provided by GitHub; full list <a href="https://github.com/actions">here</a>. The same for “<a href="https://github.com/actions/setup-java">actions/setup-java</a>”.</p><pre>name: example4a</pre><pre>on: [push]</pre><pre>jobs:<br>  build:</pre><pre>    runs-on: ubuntu-latest<br>        <br>    steps:<br>    - uses: actions/checkout@v1<br>    - name: Set up Java<br>      uses: actions/setup-java@v1<br>      with:<br>        java-version: &#39;1.8+<br>    - name: Build with Maven<br>      run: mvn clean compile test --file java-junit-calc/pom.xml</pre><p>Sometimes you may want to run your build against different target configurations (e.g. JDK versions). In that case, you may build a “matrix” strategy, where you define a variable with all the JDK versions. Then, you may reference it in the action where you set up Java.</p><p>The “build” job runs in parallel for all the different values of “java” variable; if one build fails, it does not affect other builds running.</p><pre>name: example4b</pre><pre>on: [push]</pre><pre>jobs:<br>  build:</pre><pre>    runs-on: ubuntu-latest<br>    strategy:<br>      matrix:<br>        java: [ &#39;1.8&#39;, &#39;9.0.x&#39;, &#39;12.0.2&#39; ]<br>      fail-fast: false<br>        <br>    steps:<br>    - uses: actions/checkout@v1<br>    - name: Set up Java<br>      uses: actions/setup-java@v1<br>      with:<br>        java-version: ${{ matrix.java }}<br>    - name: Build with Maven<br>      run: mvn clean compile test --file java-junit-calc/pom.xml</pre><h3>Challenges and doubts</h3><p>One challenge is validating actions locally, reproducing the virtual environment. I came across with <a href="https://github.com/nektos/act">Nektos’ act</a> tool but unfortunately, it does not support the new YAML file syntax for workflows (as of September 2019).</p><p>A doubt that I had was: “When to use input variables or environment based variables?”. It seems to be irrelevant as input variables are also translated to environment variables (in uppercase, with their name preceded by “INPUT_”).</p><h3>Beyond this article</h3><p>There’s so much more to cover related to GitHub Actions (e.g. how to share data between steps). I’ll revisit this topic as I further explore it and share additional insights about it. Stay tuned :)</p><h3>Further reading</h3><ul><li><a href="https://help.github.com/en/articles/about-github-actions">https://help.github.com/en/articles/about-github-actions</a></li><li><a href="https://help.github.com/en/categories/automating-your-workflow-with-github-actions">https://help.github.com/en/categories/automating-your-workflow-with-github-actions</a></li><li><a href="https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables">https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1636b065b823" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>