<?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 Bartosz Grzybowski on Medium]]></title>
        <description><![CDATA[Stories by Bartosz Grzybowski on Medium]]></description>
        <link>https://medium.com/@melkorm?source=rss-6ebf5efbff6b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mYI0CFHHWhsodrZKDP3OnQ.jpeg</url>
            <title>Stories by Bartosz Grzybowski on Medium</title>
            <link>https://medium.com/@melkorm?source=rss-6ebf5efbff6b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 09:21:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@melkorm/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[Testing PHP code against more PHP versions]]></title>
            <link>https://medium.com/@melkorm/testing-php-code-against-more-php-versions-b171cf66e255?source=rss-6ebf5efbff6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b171cf66e255</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Bartosz Grzybowski]]></dc:creator>
            <pubDate>Sun, 10 Apr 2016 00:00:00 GMT</pubDate>
            <atom:updated>2018-05-10T22:46:31.979Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nOmIUav74kawx9WsF9PISQ.png" /></figure><p>As PHP grows, more versions show up with better stability &amp; performance, obviously, we test our code against production environment, but what if we could test it against new versions with little effort and ensure soft migration?</p><p>Here we will use Docker &amp; Gitlab runners power to ensure that our PHP code runs on those versions: 5.5, 5.6 and 7.0.</p><p>We’ll use our own <a href="https://hub.docker.com/r/melkorm/php-docker/">Docker images</a> with configured additional extensions not provided by PHP official images, also with installed GIT and newest composer out of the box.</p><h3>What is <a href="https://gitlab.com/">Gitlab</a></h3><p>Gitlab is yet another git projects hosting platform staying that it will be free <strong>forever</strong>. How does it differ from Github or Bitbucket?</p><ul><li>no limits on public/private repos and users, more info <a href="https://about.gitlab.com/gitlab-com/">here</a></li><li>no <strong>PRs</strong> (pull requests), but <strong>MR</strong> (merge requests) — more details <a href="http://stackoverflow.com/a/29951658/947238">here</a></li><li><strong>Gitlab runners</strong> — tool to run builds on external machines, using host itself or docker — in this series we will speak only about docker runners. A runner can be either public (provided by Gitlab) or private — setup on an external machine. <em>In this example, we will use Gitlab’s public runners.</em></li></ul><h3>Preparations</h3><p>- Create an account on <a href="https://gitlab.com/">https://gitlab.com/</a><br>- Fork example repository <a href="https://gitlab.com/melkorm/php-testing">https://gitlab.com/melkorm/php-testing</a></p><p>If you want to see how it works/looks like then make some change in source and build will be automatically run against your changes.</p><h3>.gitlab-ci.yml config</h3><p>First, we need a config for our Gitlab runner. It is a configuration file written in YAML format, for full specification see <a href="http://doc.gitlab.com/ee/ci/yaml/README.html">docs</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b43aa56bdb925cfb11622a8b732f0f78/href">https://medium.com/media/b43aa56bdb925cfb11622a8b732f0f78/href</a></iframe><p>Let’s go through the config for details:</p><h4>The variables section iswhere we specify env variables which will be available for all running scripts</h4><ul><li><strong>COMPOSER_CACHE_DIR</strong> — we want to cache composer libraries across builds, we don’t want to pull all the dependencies for each build,</li><li><strong>COMPOSER_DISABLE_XDEBUG_WARN</strong> — disabling composer’s xdebug warn so it doesn’t mess with our tests output,</li><li><strong>COMPOSER_VENDOR_DIR</strong> — here we setup custom directory for composer’s vendor dir,</li><li><strong>CI_PROJECT_ID</strong> and <strong>CI_BUILD_REF_NAME</strong> are provided by Gitlab, you can read more about available variables <a href="http://doc.gitlab.com/ce/ci/variables/README.html">here</a></li><li><strong>CI_PROJECT_ID</strong> — this is ID of our project,</li><li><strong>CI_BUILD_REF_NAME</strong> — The branch or tag name for which project is built.</li></ul><h4>The <strong><em>stages</em></strong> section is where we specify groups of tasks to be executed, you can think of it as a pipeline, for example: test, build, deploy.</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8bdd397736384c528672adcfb4187640/href">https://medium.com/media/8bdd397736384c528672adcfb4187640/href</a></iframe><p>We only specify <em>test</em> as this is our only stage in this scenario.</p><h4>Jobs</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54b3933b03b329be90e44b13b2977231/href">https://medium.com/media/54b3933b03b329be90e44b13b2977231/href</a></iframe><ul><li>test55 — job name</li><li>image — docker image pulled from <a href="https://hub.docker.com/">Docker Hub</a></li><li>stage — to which stage task belongs to</li><li>script — list of commands to execute</li></ul><blockquote>mkdir -p /storage/vendor/${CI_PROJECT_ID}/${CI_BUILD_REF_NAME}</blockquote><p>Here we prepare storage for composer’s dependencies</p><blockquote>ln -s /storage/vendor/${CI_PROJECT_ID}/${CI_BUILD_REF_NAME} vendor</blockquote><p>link the storage to the vendor dir in our app directory</p><blockquote>make</blockquote><p>run our make script to install dependencies and run tests.</p><h3>PHP Testing</h3><p><strong>Makefile — </strong>quickly adds console for repetitive tasks done with our application from command line, like:</p><ul><li>installing dependencies,</li><li>testing,</li><li>building,</li><li>releasing,</li><li>and many more.</li></ul><p>Example <strong>Makefile</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1af3b0607b0bde09db083c82cb6df7bc/href">https://medium.com/media/1af3b0607b0bde09db083c82cb6df7bc/href</a></iframe><p>structure is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3322d4f3ebd8b0306472006226e33a5f/href">https://medium.com/media/3322d4f3ebd8b0306472006226e33a5f/href</a></iframe><p>if you run make without params it will run the first command.</p><p>Now we can call <strong><em>$ make</em></strong> and test will execute after composer, example output:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eabf1cf324bd100efa4288cd47c736f5/href">https://medium.com/media/eabf1cf324bd100efa4288cd47c736f5/href</a></iframe><p>You can see example build &amp; output <a href="https://gitlab.com/melkorm/php-testing/builds/1038812">here</a></p><h3>Wrap up</h3><p>As you can see it is easy to test your code against many PHP versions. All you need is <strong>Gitlab</strong> and <strong>Docker</strong> image supporting your stack. Of course, you don’t need to use Gitlab, you can configure your Jenkins or any other build tool to test your code on different Docker images. We like Gitlab as this offers many features out of the box with little effort. So if you start a new project, or want to automate testing with current one — try Gitlab as it might be the right tool for you.</p><p><em>Originally published at </em><a href="https://melkorm.github.io/2016/04/10/gitlab-runner-and-php/"><em>melkorm.github.io</em></a><em> on April 10, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b171cf66e255" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tips for first steps with GO]]></title>
            <link>https://medium.com/@melkorm/tips-for-first-steps-with-go-99eb57eef9cd?source=rss-6ebf5efbff6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/99eb57eef9cd</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[go]]></category>
            <dc:creator><![CDATA[Bartosz Grzybowski]]></dc:creator>
            <pubDate>Sat, 19 Mar 2016 00:00:00 GMT</pubDate>
            <atom:updated>2018-05-10T22:38:32.786Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>With this post, I want to highlight few things when staring with GO for new people which sometimes doesn’t seem so straightforward after reading <a href="https://golang.org/doc/install">https://golang.org/doc/install</a>.</p><h3>First</h3><p>Install GO’s version 1.6+ there is no point to use any previous versions as with 1.6 version GO added vendor support (experimental in 1.5). What does it mean? That dependencies are tight to a project, not to the global GO’s dependency catalogue.</p><p>If you come from <strong>PHP</strong> world you can compare it to <em>global</em> command for the <strong>composer</strong> — yes, prior 1.5 and vendor support all go’s dependencies were installed as <em>global</em>.</p><p>PS. If you are looking for GO’s dependency management system see <a href="https://github.com/Masterminds/glide">glide</a> (update see <strong>vgo</strong> or <strong>dep</strong>).</p><h3>Second</h3><p>Make your <strong>$GOPATH</strong> next after installing GO bins — and accept it’s structure, personally it’s not great, but it doesn’t do much harm. (update: this will change with upcoming <strong>vgo</strong>)</p><h3>Third</h3><p>Remember — looping over array / slice does the <strong>copy</strong>, so:</p><p>package main</p><pre>import “fmt”</pre><pre>func main() {<br> someArray := []int{1, 2, 3}<br> for _, n := range someArray {<br>  // this won’t work<br>  n = 6<br>  // without this we will get “n declared and not used” error<br>  // so it should rise a thought that we do something wrong here<br>  fmt.Println(n)<br> }<br> fmt.Println(someArray)<br> for key, _ := range someArray {<br>  // but this will<br>  someArray[key] = 6<br>  fmt.Println(key, someArray[key])<br> }<br> fmt.Println(someArray)<br>}</pre><h3>Fourth</h3><p>Accept GO’s <em>“n declared and not used”</em> design concept — GO doesn’t like unused variables, that’s why you’ve seen “<strong>_</strong>” in previous code. It’s like saying <strong>echo “my variable” &gt; /dev/null</strong></p><p>PS. I find it a bit annoying when playing with some ideas &amp; code.</p><h3>Fifth, and last</h3><p>Use an editor with support for the <a href="https://golang.org/cmd/gofmt/"><strong>gofmt</strong></a> which will cover almost all issues mentioned here: <a href="https://github.com/golang/go/wiki/CodeReviewComments">https://github.com/golang/go/wiki/CodeReviewComments</a>.</p><p>PS. Personally, I use <a href="https://atom.io/"><strong>Atom</strong></a> with the <a href="https://github.com/joefitzgerald/go-plus"><strong>go-plus plugin</strong></a></p><p><em>Originally published at </em><a href="https://blog.melkorm.pl/"><strong><em>https://blog.melkorm.pl</em></strong></a><em> on March 19, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99eb57eef9cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>