practicalli / clojure

Practicalli Clojure REPL Driven Development
https://practical.li/clojure/
Creative Commons Attribution Share Alike 4.0 International
89 stars 36 forks source link

Clojure deps projects with Circle CI #183

Open practicalli-johnny opened 4 years ago

practicalli-johnny commented 4 years ago

Create a tutorial that shows how to set up a deps.edn project with CircleCI?

Documentation for a solved problem helps the community focus on solving other problems.

No tutorial was found in the Clojurians Slack archive or doing a web search (although Chris' Duct tutorial with Leiningen is very nice). There are a sample config.yml files https://github.com/borkdude/edamame/blob/master/.circleci/config.yml https://github.com/borkdude/carve/blob/master/.circleci/config.yml https://github.com/seancorfield/honeysql/blob/master/.circleci/config.yml
https://github.com/seancorfield/next-jdbc/blob/develop/.circleci/config.yml https://github.com/borkdude/clj-kondo/blob/master/.circleci/config.yml

Create a canonical configuration, which can be easily updated with the version of Clojure CLI tools to use (to keep up with Alex)

CircleCI orbs

Content to create

Additional aspects

Using kaocha orb as a test runner (unit and generative testing) https://circleci.com/orbs/registry/orb/lambdaisland/kaocha

Using Heroku orb for deployment to Heroku https://circleci.com/developer/orbs/orb/betterdoc/deploy-to-heroku

Review other orbs https://circleci.com/developer/orbs

Common approach

Install Clojure CLI as part of the config.yml steps Windows is more challenging to install Clojure CLI, an alternative is to use borkedude deps.clj

use a vanilla jdk image rather than a clojure image with Leiningen if that tool is not used

Review Circle CI images

https://circleci.com/docs/2.0/circleci-images/#clojure shows the images available for Clojure on Circle which include images with tools.deps

The default image for a clojure project seems to be to set it up with the circleci/clojure:lein-2.7.1 image.

Interestingly, it seems as if Circle autodetects that your project is a Clojure project, maybe Circle could be taught to detect if its a deps or a lein project as well.

One challenge to writing a guide is that the deps.edn project setup is so free form, that it's hard to generalize into a non-parameterized recipe

Babashka script to generate a config.yml for multiple operating systems

https://github.com/babashka/pod-babashka-etaoin/blob/master/script/generate_circleci.clj For the bb script, I assme this is run from the root of the Clojure project you wish to generate the config.yml from https://github.com/babashka/pod-babashka-etaoin/blob/master/script/generate_circleci.clj (edited)

The only reason I'm generating the circleci config there is that there's a matrix of builds: two executables for three OSes

practicalli-johnny commented 4 years ago

http://practicalli.github.io/clojure/testing/integration-testing/circle-ci/