{
"$type": "site.standard.document",
"canonicalUrl": "https://numergent.com/2016-10/Using-Gitlab-CI-with-a-Clojure-project.html",
"path": "/2016-10/Using-Gitlab-CI-with-a-Clojure-project.html",
"publishedAt": "2016-10-10T07:06:30.000Z",
"site": "at://did:plc:cf6futaebyc2k4wgzsr4v42k/site.standard.publication/3mp2ewx43js2g",
"tags": [
"git",
"continuous integration",
"clojure",
"docker",
"postgresql"
],
"textContent": "Gitlab allows you not only to have free private repositories, but also to test them using free runners. These can run automatically, on push, for any branch or tag.\n\nI keep a few private repositories with them, for personal projects and small experiments. I decided to give Gitlab CI a shot for a PostgreSQL-backed Clojure project.\n\nThere's a basic example on the Gitlab CI repository. It gets and installs lein, which isn't necessary. Instead, we'll build use the clojure:lein Docker image.\n\n\n\nLet's start with an empty .gitlab-ci.yml file on your repository's root.\n\nYou'll see I've also included Postgres as a service since it's what I'm using for the database.\n\nWe'll then need to add a section for any environment variables \n\nGitlab also allows you to define secret variables on a per-project basis, but there's no need for that here. \n\nFinally, we'll add our before_script section, which just updates apt-get and loads the dependencies.\n\nUpdate: Notice that I'm updating the package lists using apt-get. This is necessary because I'll also need to install the Postgres client. If you don't need to install anything using apt, you might save some build time by removing that line.\n\nBefore proceeding to test, we'll install the Postgres client, initialize the database (adding some plugins), and run the migrations.\n\nAnd voilá! Tests will run on push. You can find a history for the status of the Pipelines section of your project.\n\nIf for any reason you don't see a Pipelines option, make sure that Builds are enabled in the project's settings.\n\nYou'll also get a build history\n\nHere you'll find the complete file as a snippet.\n\nCheers!",
"title": "Using Gitlab CI with a Clojure project"
}