26 Mar 2020 · Semaphore News

    Clojure on Semaphore

    3 min read
    Contents

    We’re very excited to announce official support for testing and deploying Clojure projects. Clojure is the third official language supported by Semaphore.

    Continuous integration for Clojure projects in 1 minute

    The steps for setting up your Clojure project on Semaphore are as simple as for a Ruby or JavaScript project.

    If you don’t already have a Semaphore account, sign up for a free 30-day trial for unlimited builds, unlimited number of collaborators, unlimited deployment and two processors for parallel testing.

    New accounts will need to authorize Semaphore to access GitHub repositories, in order to be able to pull and receive notifications about code changes, post commit status in pull requests etc.

    On your dashboard, click on “Build a New project”. Semaphore will fetch basic information about projects that you have access to on GitHub and ask you to select one.

    Semaphore will now analyze your repository and recognize that it is a Clojure project, presetting lein test as your build command. Leiningen 2.3.4 and OpenJDK 7 are preinstalled on the platform.

    What remains is to optionally invite your collaborators to Semaphore and – launch the first build. From that point, Semaphore will automatically test your project after every push to your Git repository.

    After the first build, your dependencies will be cached for later reuse.

    If you are developing a project that works with a database, see our documentation page about database access for information about the engines available and required credentials.

    Why Clojure

    Clojure is a dynamic, general-purpose programming language that runs on the Java Virtual Machine. It is a dialect of Lisp, sharing the code-as-data philosophy, support for macros and functional programming. It provides immutable, persistent data structures and is designed to support high-performance, concurrent applications.

    The heart of Clojure is simplicity. Bottom line is, all code is in small functions grouped in namespaces whose scope of effect is very limited and understandable. This gives you confidence and leads to easy composition of higher-order systems. It does not take long to learn the syntax of the language; the challenge lies in changing the traditional object-oriented mindset used to mutability and side-effects and working with a different set of programming abstractions.

    These characteristics sound a lot different if the last language you’ve studied was something like Ruby or Python. You cannot write imperative code in Clojure, design patterns go out of the window, concurrency is easy to implement and reason about and unless you really try you can’t create global, mutable state. There are many use cases where this is a blessing; so far most of them are on the axis between complex systems and data analysis.

    Clojure adoption is on the rise, people at conferences are beginning to talk about replacing “legacy Ruby apps” and quite a few smart and experienced engineers are recommending it as the next language developers should master.

    Useful resources for learning Clojure

    Tutorials

    Introduction to Clojure – Modern dialect of Lisp by Karsten Schmidt and Ricardo Sanchez
    Clojure – Functional Programming for the JVM by R. Mark Volkmann

    Presentations

    Clojure in 10 big ideas by Stuart Halloway
    Are we there yet? by Rich Hickey (creator of Clojure)
    Simple Made Easy by Rich Hickey
    Presenting Clojure to Chicago Java Users Group by Uncle Bob Martin
    ClojureTV

    Books

    Clojure in Action
    – The Joy of Clojure
    Clojure Programming

    When you’re wondering which tools are available for some job, check out Clojure Toolbox.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Avatar
    Writen by:
    Marko Anastasov is a software engineer, author, and co-founder of Semaphore. He worked on building and scaling Semaphore from an idea to a cloud-based platform used by some of the world’s engineering teams.