-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving build to CircleCI #102
Conversation
Thank you for looking at this! 🙌
It can probably handle it okay. It merges multiple builds from the same CI provider – see here – it should do the same for multiple providers. The hit counts will of course be inflated but the coverage should still be measured correctly.
Agreed. @bbatsov you will need to activate CircleCI for this repo here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great overall. Thanks again for looking at this!
A few other notes:
|
Codecov Report
@@ Coverage Diff @@
## master #102 +/- ##
=======================================
Coverage 85.78% 85.78%
=======================================
Files 1 1
Lines 190 190
Branches 11 11
=======================================
Hits 163 163
Misses 18 18
Partials 9 9 Continue to review full report at Codecov.
|
Added Cloverage/Codecov job. See results here: https://codecov.io/gh/shen-tian/piggieback/commits |
The source for the orbs I've used is here: https://github.com/lambdaisland/meta/tree/master/circleci The docker images used are created like this: https://nextjournal.com/plexus/openjdk11-%2B-clojure |
Thanks! Will simplify a few things. @plexus: I haven't looked into it, but what does it take for an orb to be in the CircleCI repo? @cichli : other than the CircleCI setup in the nrepl org, what do you feel we still need to do here? |
I did some tidying up, with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great to me. Fantastic work, thank you! 🙌
I will merge once we have a confirmed build on this repo. cc @bbatsov :-) |
Sorry for the delay. I'll take a look over the weekend. |
.circleci/config.yml
Outdated
- checkout_code | ||
- lint_code: | ||
name: Code Linting | ||
requires: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with all those requires? Isn't there some way to avoid this repetition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gist of this is that we check out the code + download deps once, and test n times. Thus each of the tests require the checkout_code
step.
Alternatively, we can just run n tests, and have each job do its own checkout etc. I'm not sure either is better than the other given that everything runs fast enough.
Answering the next question: in CircleCI, each you you commit, you trigger a workflow, which is comprised of many jobs. You can set up dependency between the jobs, so they run in order while allowing for parallel jobs etc.
.circleci/config.yml
Outdated
|
||
workflows: | ||
version: 2.1 | ||
build_and_test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what a workflow
is exactly in CircleCI, but as we don't really do any explicit "build", I think the name is a bit confusing. I guess the real stages of the build process are "Linting" and "Running tests".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build_and_test
refers to the overall process/workflow (i.e. linting + testing). Happy to take suggestions on the right name.
.circleci/config.yml
Outdated
requires: | ||
- checkout_code | ||
- test_code: | ||
name: java8, clj1.9 tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess "Test Code" appears somewhere in the output, so for name I'd rather have "Java 8, Clojure 1.9"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do.
@shen-tian there are lots of small jobs and workflows here. In my experience, most of the time spent running tests is constant factors of pulling images, downloading dependencies, starting up containers, e.t.c. I wonder if you could get away with a smaller number of workflows, each doing more work in a single job? The pattern I was imagining was to have one job per JDK version, and have each job do all of the work in one go, rather than splitting it up over multiple jobs. Btw, I'm super impressed with what you've done here, very nice usage of the new CircleCI features, I especially liked the JDK version selection. |
I've made a different branch which has two jobs: https://circleci.com/gh/danielcompton/workflows/piggieback/tree/use-circle-ci-dc The main benefit of these changes is that the CI config might be a little bit easier to follow. The downside is that the wall-clock time is a bit slower (4 mins instead of 3 mins), and some things are done multiple times unnecessarily, like eastwood and clfmt. Edit: Generating combinatorial expansion of Lein test profiles brings the test time down to roughly 3-4 minutes for both jobs, although some of my perf improvements would also apply to this PR and could speed it up further. |
This actually came down less to how to get all the tests to run, but more showing, at a glance, which jobs in the build matrix failed. This is probably less important for piggieback, and more so for the likes on nRepl itself. Even here, we are testing across the combination of JDK versions, Clojure versions, and nRepl versions. It's thus useful to see, e.g. the build broke on JDK11 + Clojure 1.9 and nRepl 0.6, as an example. Given the assumption that's a desirable thing (is it? I'm inferring this from how the Travis build is set up) the maintainers would know), having high granularity at the jobs level would be useful. Re optimising CircleCI jobs for runtime, I've definitely found, as you point out, that pulling images takes up 20s or more, and penalises otherwise clever looking many-small-job workflows. The current setup is definitely not optimising for run time. I realise we are testing all nRepl versions via the makefiles, so we are not actually splitting those out into the separate jobs. I've got a separate question about having some of the project complexity spread across Steps forward: more input on the above welcome? Making any of the changes discussed should be quick/easy enough. |
Yep, this is a pretty good argument. I don't feel strongly about this, just wanted to test out an alternative, but it is nice being able to see the specific cases that fail at a glance. |
Yeah, I agree. It's nice to be able to quickly figure out what exactly failed.
I think we've added the makefile mostly for the benefit of end users, who'd run some tasks manually, and for readability (as some commands had pretty long lein commands associated with them). I don't even know what an orb is so I can't comment on this, but in general I can imagine that most projects would have similar builds. |
Updated this to be in line with nrepl/nrepl#131. Managed to reuse a lot of config, so we are looking good for some Orbs later on. Updated the badge and removed travis completely. Might still need the project enabled on CircleCI |
Thanks! |
First stab at moving the linter(s) and builds over to CircleCI. Notes
master
Does not do the codecov side, as I imagine you don't want both travis and CircleCI doing that? But that should be relatively easy to get.
Does not user Orbs, as I suspect that's better left to the stage when we have a lot of projects that need to share configs, and it's clear what's needed.
Edit: link on where my fork is building: https://circleci.com/gh/shen-tian/workflows/piggieback/tree/circleci