Fork me on GitHub
#circleci
<
2020-06-26
>
practicalli-johnny10:06:20

Is there a tutorial that shows how to set up a deps.edn project with CircleCI? Looking through the archive of this channel and doing a web search, I found no such thing (although Chris' Duct tutorial with Leiningen is very nice). I have a few sample config.yml files from the archived and borkdudes babashka generator.. If there isnt a tutorial, I'll figure this all out and write up what I discovered and add it to the Practicalli Clojure book and maybe do a broadcast on the subject. Any feedback / suggestions welcome.

practicalli-johnny11:06:46

Oh and I voted for the related CircleCI issue (making 3 votes) https://ideas.circleci.com/ideas/CCI-I-256

borkdude11:06:13

@jr0cket What's the problem? I usually install clojure and that's all there is to it basically?

practicalli-johnny11:06:59

Hmm, I will let you know how I get on over the weekend then...

borkdude11:06:19

Most of my projects have an "install clojure" step

borkdude11:06:37

For Windows it's annoying, there I use my own project called deps.clj

practicalli-johnny11:06:53

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

borkdude11:06:50

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

practicalli-johnny11:06:00

I'd like to have some documentation that shows how to do this without searching through the clojurian slack archives. If its a solved problem, then documentation helps the community solve other problems.

borkdude11:06:29

A more normal JVM project example would be: https://github.com/borkdude/carve

borkdude11:06:36

I'm sure there are images that already have clojure installed, but I don't bother with those, just make my own

practicalli-johnny11:06:12

I havent seen anything yet with Clojure CLI installed, only Leiningen. I would take the approach sean did of using a vanilla jdk image rather than a clojure image with a tool I was not using The cli install is the same approach I've used for other projects in the past, its been a while since I set all this up, so examples will help speed this all up. Thanks for the pointers. I work on this next week and see how much comes flooding back :)

borkdude11:06:52

I do have a separate script for Mac builds, because the vanilla clojure script didn't work for me

borkdude11:06:59

Feel free to copy it 😉

slipset11:06:07

https://circleci.com/docs/2.0/circleci-images/#clojure shows the images available for Clojure on Circle

👍 3
practicalli-johnny11:06:46

Excellent, thats on my todo list now. Thanks.

slipset11:06:38

And there is a ton of tools-deps images there

practicalli-johnny11:06:13

Things are looking more promising than I thought, thanks.

slipset11:06:11

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

slipset11:06:57

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.

practicalli-johnny11:06:45

Lots of things to test then 🙂 Thanks.

slipset11:06:21

Just tell me to be quiet when you've had enough of my ramblings, but I see one problem and it would be that if you were to write a tutorial on this, the deps.edn project setup is so free form, that it's hard to generalize into a non-parameterized recipe

slipset11:06:20

Like circle's default clojure-setup has lein test as their run thingy. That could be literally whatever if you use deps.edn

practicalli-johnny11:06:27

Please ramble on, its very useful understanding your experiences and comments...

slipset11:06:21

Nothing profound here, other than that lein test is a thing in the leiningen world but in hte deps.edn world, it's up to the user to name the alias, so running your tests with deps.edn could be clj -A:test, clj -A:koacha, or clj -A:xyzzy .

practicalli-johnny11:06:54

If everyone used my practicalli/clojure-deps-edn configuration then that wouldnt be a problem 🙂 (I dont expect everyone to do this)

slipset11:06:45

So I guess (and I'm sure you're aware of) if you're writing a tutorial on setting up a project with deps.edn, it would be wise to suggest good names for the aliases (which should probably not be the name of the thing implementing the feature, eg clj -A:test over clj -A:kaocha (and clj -A:uberjar over clj -A:depstar or whatever)

slipset11:06:10

Classic. If everyone would just do as I said, the world would be such a great place 🙂

practicalli-johnny11:06:01

I have chosen what I believe to be descriptive names for the aliases used in that configuration, especially where there are multiple options for the same task https://github.com/practicalli/clojure-deps-edn

practicalli-johnny11:06:28

I've added all the suggestions and ideas to this issue and will write up my experiences next week. https://github.com/practicalli/clojure-practicalli-content/issues/183 If anyone has any other suggestions or examples to share, I'll keep an eye out. Thank you all.

seancorfield16:06:35

It's very easy to tell GitHub Actions to run a matrix of tests on different Java (JDK) versions. Is that easy to set up on CircleCI as well? next.jdbc runs tests on JDKs 8, 11, and 14: https://github.com/seancorfield/next-jdbc/blob/develop/.github/workflows/test.yml#L8-L10

borkdude17:06:10

much easier than being dependent on some CI's DSL

borkdude17:06:39

but maybe CircleCI does support it, don't know

seancorfield17:06:04

Yeah, I was looking at that script -- which is why I asked 🙂 I find CircleCI's docs pretty hard to navigate when you're looking for a specific "how-to" answer...

borkdude17:06:33

in my case I had to make one build but with one different environment variable for three values

borkdude17:06:25

I see now that I could have done that using the matrix stuff (although even @marc-omorain did not mention it when I showed him my script ;))

seancorfield17:06:03

Ah, it's been a few months since I last went looking and that seems to be new in April. Thank you @borkdude!

seancorfield17:06:07

(I do remember reading something about Orbs at some point but felt it was a weird name and very poorly explained in the docs -- and looking at that blog post, it's a lot of boilerplate just to define matrix when compared to something like GitHub Actions!)

borkdude17:06:33

with the "do it yourself" scripting approach, I can prevent learning all these config DSLs, which is a win to me personally