-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add test workflow #249
Add test workflow #249
Conversation
Example: https://github.com/zharinov/zprint/runs/7554958077?check_suite_focus=true UPD. A-a-and it stopped working once I've created this PR |
Works with separated CLJ (ubuntu) and CLJS (macos). Example: https://github.com/zharinov/zprint/actions/runs/2752294939 UPD. ClojureScript testing is still quite slow, though |
Wow, I'm impressed. I looked over the results from the runs you did. I haven't even tried Java 17, and you seem to have used it with no problems. That's cool on its own. You also did the clojure tests with the test-runner, which I've never done either. Overall, once you split the tests, it all looks like it worked pretty well. I've not tried any of this on Ubuntu, but I have no reason to think it wouldn't work, and you seem to have made it happen. I expect your response to my comment in the Issue will elicit some additional information. I guess my question here is: Is this what you were intending to offer, and if I accept this PR, then you are finished? Or are you looking for a additional things that would be helpful, or what? Thank you so much for doing this. I have already learned a lot. I knew nothing about Temurin Java, for instance. Thanks again! I'm not going to accept this PR until we have additional dialog about what your plans are, but I expect that I will do so eventually. |
My intention was to make the first step, because at the moment I don't know how complete solution would look like. The further course of action can be something like this:
|
I don't know much about current Java implementations either, but what I know is that |
That sounds great. I'm thinking that step one of getting some CI testing is almost there. I think that consists of:
This is just my idea, I'm open to alternatives. You've achieved 1-3. I'm thinking that #4 probably isn't too hard. Once you've build the uberjar, (which I think you have), you just:
Now, presently, Doing #5 is ... interesting. I can show you how I do #5 "by hand", so to speak. I don't know how hard it will be to get that into a GitHub action. The short story on building When building Anyway, the files are:
This is the output on the screen when it builds:
This is using an old version of graalvm, but whenever I upgrade something else breaks, and since this works fine, I haven't had any motivation for upgrading. I don't know if this version even exists anymore. I know that if you try to download graalvm, they don't even have a Jave8 version. Oh, that may be a problem. What I've shown here is how to build a Java8 version of zprintl. I think you will have a java17 uberjar, and so that probably won't work great with building a java8 version of zprintl. But maybe it doesn't matter. I'm hoping that you can figure out how to get a working version of zprintl using GitHub actions. From that, you can then do the I'm also hoping that whatever you build in the GitHub action can be saved somewhere so that it can be used in the release, and I don't have to keep doing it by hand. I don't mind doing the MacOS one by hand, as I do it just for testing, but the linux one has been a pain since I upgraded my laptop in early 2020. I don't know how or where you can save results/output from a GitHub action, but that would be a goal. I'd just as soon not put it directly into a release, because it might be the release version. There is a whole thing about how to package up the release that we need to discuss, but that is probably not today's problem. I think today's problem is to have something to package up for a release, not so much how to do it. Even without figuring out how to save a zprintl for a release, if you can get 1-5 working in your fork, I'll be delighted to take it. |
If successful test outputs nothing, it may be as easy as: - name: Test config
run: test "$(./test_config 1.2.3 uberjar)" = "" I'll read your comment more carefully tomorrow, it's night time in my location. |
Good point about
Which is not useless information, but makes the "no output, it must have worked" not be a useful approach. I'll work on Thanks! |
Okay, I see now. Another approach would be checking whether every non-first line of script output is starting from |
I just hacked |
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.
A few humble suggestions
.github/workflows/test.yml
Outdated
@@ -0,0 +1,82 @@ | |||
on: | |||
- push |
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 think that w/ this syntax it won't run on pull requests
uses: actions/setup-java@v3.4.0 | ||
with: | ||
distribution: temurin | ||
java-version: 17 |
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.
Have you considered using a matrix syntax? Running it on all the LTS JDK versions would seem reasonable.
cli: latest | ||
lein: latest | ||
bb: latest |
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.
Have you considered using fixed versions? It's often quite annoying to have CI builds break for seemingly no reason
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.
Yes, and actually I would like to propose using dependency updating the tool I'm actively contributing to: https://github.com/renovatebot/renovate
The app is free for GitHub, and it handles project.clj
as well as deps.edn
.
Using it, we would have both of the two worlds: fresh dependencies (thanks to Renovate) and merge confidence (thanks to CI 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.
Here is my demo of what is possible with automatic dependency updates:
https://github.com/zharinov/zprint/pulls
@kkinnear What do you think?
(I need to fix Leiningen commented deps handling, though) — done
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.
Wow, that's amazing. As you may have noticed, I rarely change the versions of the things on which zprint depends, as I find it a pain to debug things like that when they break. Not that they break all that often, other than graalVM, which I noticed isn't something that renovate
found. The thought of having major dependencies automatically updated (or at least automatically PR'ed for update) is kind of scary, but probably a good idea. As long as we really believe that the automated tests will run.
I didn't read too closely, but is it the case that if it automatically accepts the renovate
PR's, and the tests don't run correctly, then it will back them out or something? Or is that a manual operation?
In any case, I'm up for giving renovate
a try, but I think that first we need to get the tests to work in GitHub actions, including test_config
, and at least the Linux pre-built binary (zprintl-1.2.n
). It would be nice to do the Mac version as well, but I expect that is not possible with GitHub actions. Anyway, once the tests work, then adding renovate
to the mix would seem like a good, if kind of unsettling, idea. Thanks for proposing it!
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.
It can create PRs for you to review and merge, but also can be configured to automatically merge non-major releases once all CI checks are passing, leaving major updates up to you. Also it can create Dependency Dashboard issue for managing dependencies from the single central place.
Actually, it's very configurable. For example, I think it's possible to make it upgrade clojure dependencies that are documented in the markdown files (using regex).
So again, recommend you to give it a try once we're done here with build/test pipeline.
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.
Speaking of GraalVM, it's also possible to upgrade it automatically (and test on CI), as soon as we refer to https://github.com/graalvm/graalvm-ce-builds releases somewhere in the code
.github/workflows/test.yml
Outdated
run: clojure -M:cljtest:humane:runner | ||
|
||
- name: Integration tests | ||
run: ./test_config 1.2.3 uberjar |
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.
It seems a good idea to run test_config through Shellcheck.
Also for any .sh script I recommend the following header:
#!/usr/bin/env bash
set -Eeuxo pipefail
cd "${BASH_SOURCE%/*}/.."
- name: Integration tests | ||
run: ./test_config 1.2.3 uberjar | ||
|
||
test-cljs: |
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.
You might want to at least draft a lint job. https://github.com/clj-kondo/lein-clj-kondo needs particularly little setup (no graalvm installation, etc)
Status update: I managed to create workflow that is covering all six requirements mentioned earlier (see example). However, it has some ugly parts (e.g., version string detection) and next week I'm about to refactoring initial solution. |
That's beyond wonderful! Thanks for the example, it was great to see it all working! I'm truly impressed. Two questions:
I'm seeing that actions will do MacOS as well as linux, so downstream it might be valuable to have all of the released binaries built by actions, instead of the MacOS one on my laptop. Then maybe there would be a separate action/workflow to build the release when I tagged and pushed the tags to GitHub. But that isn't today's task. I'm very impressed and excited about where this is all going. I'm looking forward to having this all work. It is going to make releasing zprint so much easier! Thank you so much for pursuing this work! |
Today I've created new GitHub action for Clojure tooling that combines anther 3 actions ( |
One problematic thing I see now is that build automation for M1 processor. GitHub doesn't provide runners on this chip, so we need to build it somewhere else. I tend to think it should be CirrusCI, which is the place where the Babashka M1 binary is being built. |
So, I'm not currently providing M1 pre-built binaries. I have found the MacOS binaries built for Intel by graalVM to be quite fine when running on an M1 MacBook Air. I suppose that M1 specific binaries might be even better, but so far that hasn't made it near to the top of my list for things to do for zprint. |
Seems like this one can be closed now |
Closes #248