-
-
Notifications
You must be signed in to change notification settings - Fork 4
Add docker integration, CI, and internal elm-review
#27
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
Conversation
Fix solution_cache.tar path
ErikSchierboom
left a comment
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.
Great stuff! I've left some comments.
@iHiD Could you give this repo access to the proper secrets?
| mkdir -p "$OUTPUT_DIR" | ||
| docker run \ | ||
| --rm \ | ||
| --network none \ |
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.
Just a FYI: we currently don't yet run on a readonly filesystem, but this might change in the future. You don't have to change anything, but just wanted to point it out.
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 does readonly mean exactly? Not being able to create any sort of file anywhere on the container?
Because if that's the case, it would become a lot more tricky to make the analyzer or even test runner work...
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.
Complementary remark, the test runner cannot work "simply" in readonly because the elm compiler is writing to a lock file inside $HOME/.elm during compilation. It can be done by changing the location of the $ELM_HOME variable to a writable place during execution but that's very cumbersome for the docker code, because it also means copying the contents of that directory to have all pre-installed packages available.
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.
No network is fine though, my remark was just regarding readonly
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 does readonly mean exactly? Not being able to create any sort of file anywhere on the container?
Because if that's the case, it would become a lot more tricky to make the analyzer or even test runner work...
It would mean that by default all directories are indeed not writable, save for a couple of exceptions: the /tmp dir and the /output dir. But as we've not yet implemented this (or decided we want this), I wouldn't worry about it. Note that most of the test runners have been implemented this way (to work with readonly), but for some tracks it can indeed be more of a bother.
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.
If /tmp stays writable, then I believe we can make it work. No worries then :)
| @@ -0,0 +1,2 @@ | |||
| {"summary":"Check the comments for things to fix. 🛠 ","comments":[{"comment":"elm.strain.do_not_use_filter","type":"essential","params":{}}]} | |||
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's important to have https://github.com/exercism/website-copy/pull/2161/files merged before the analyzer property is set to true in the track's config.json file: https://github.com/exercism/elm/blob/main/config.json#L19
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.
Noted! I didn't know about that line inconfig.json, thank you.
I don't think I can request a review from @mpizenberg or @ceddlyburge on website-copy, they are not on the list. How can we add them in there? We will need to approve analyzer comments in the future. Maybe in the mean time you could approve 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.
I've approved.
I don't think I can request a review from @mpizenberg or @ceddlyburge on website-copy, they are not on the list. How can we add them in there? We will need to approve analyzer comments in the future. Maybe in the mean time you could approve it?
I don't know if @mpizenberg and/or @ceddlyburge want to be added to the website-copy team, as they'll get a lot more notifications then.
We have a separate team for reviewing website-copy PRs, so you could always ping them (@exercism / website-copy).
You could then first request a review from @mpizenberg or @ceddlyburge and when they're happy, ask for the website-copy team to approve and merge.
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.
Indeed, I'd prefer not to be added to website-copy. I don't mind occasionally being pingged there for analyzer messages though, even if I cannot officially review. I might just comment if I find the time, or not if I don't.
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've just merged the website-copy PR
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 I am added to website-copy, but I unwatched the repo, so I only get emails when people mention me or request a review. That works for me.
But sure, we can ping people for analyzer messages.
This reverts commit c4464fd.
You have my blessing :) |
|
Mine too :) |
jiegillet
left a comment
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.
Thank you very much.
I think I've addressed all the comments.
| mkdir -p "$OUTPUT_DIR" | ||
| docker run \ | ||
| --rm \ | ||
| --network none \ |
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 does readonly mean exactly? Not being able to create any sort of file anywhere on the container?
Because if that's the case, it would become a lot more tricky to make the analyzer or even test runner work...
| @@ -0,0 +1,2 @@ | |||
| {"summary":"Check the comments for things to fix. 🛠 ","comments":[{"comment":"elm.strain.do_not_use_filter","type":"essential","params":{}}]} | |||
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.
Noted! I didn't know about that line inconfig.json, thank you.
I don't think I can request a review from @mpizenberg or @ceddlyburge on website-copy, they are not on the list. How can we add them in there? We will need to approve analyzer comments in the future. Maybe in the mean time you could approve it?
| @@ -0,0 +1,53 @@ | |||
| FROM node:lts-alpine AS builder | |||
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 use a tool called HadoLint in VsCode to lint Dokerfiles. It has 3 warning messages and 1 info message for this file. There is nothing drastic but it is probably worth taking a look. If you can't run the tool yourself let me know and I can drop the messages in here or we can have a call.
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 managed to install it and make it happy :)
Thank you for the recommendation.
| @@ -1,4 +1,4 @@ | |||
| #!/usr/bin/env bash | |||
| #!/bin/sh | |||
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.
Is this part of the smoke test? It might be worth making this obvious in some way if so.
f77ae93 to
68cc357
Compare
|
I know I was told not to worry, but I modified run.sh and the smoke test so that it would run in read-only (but still writing in Is there anything left to do before generating the secrets and activating the analyzer in the Elm config file? |
Haha It's like you just climbed a mountain, you have a great view, but there is this last spot, 50m away, and your journey would not be complete until you make sure the view isn't better from up there. If I have a small nitpick (without checking in detail all the PR), why are some files are with an eol at the eof while some do not have an eol? I think the posix standard ask that we add an eol as the last char of a file. If you use VSCode it should be this setting: "files.insertFinalNewline": true |
|
Haha yeah, it's that kind of feeling. And when you reach this other perfect peak, you spot another one :) Thank you for the EOL tip, it is something that I never really paid attention to, I do use VSCode and I've enabled the setting. |
.github/workflows/docker.yml
Outdated
| @@ -0,0 +1,21 @@ | |||
| name: Deploy | |||
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.
This file is now a duplicate of the deploy.yml file and can be removed.
|
From my point of view, this is ready to be merged! |
|
me too :) |
This PR is meant to address everything left to do before deployment.
Docker
It took me a while to figure out how docker works and how to debug it (especially since both
elmandelm-reviewdon't have explicit offline modes), but thanks to useful advice from Slack, I think I managed to get to something that works. I ended up with something very similar toelm-test-runner.Of course, please do review carefully since this is my first docker build.
I made various changes to the shell scripts so that the same ones can run both locally and in docker.
CI
I copied
docker.ymlpretty much as is (I only removed themasterbranch) from an Elixir repo, that should be fine. It doesn't run on my fork, probably @ErikSchierboom has to do some admin magic on it?elm_tests.ymlruns all the tests withelm-test(notelm-test-rsbecause version 1.1 doesn't allow tests with the same name, but IMO they make sense here. I didn't check later versions), checks the formatting, runselm-reviewon the repo, and runsrun-tests-in-docker.sh, which is basicallybin/smoke_test.shin the container.elm-reviewI took the approach of (quote from README)
So I would like to keep the rules from the repo the same as the common rules we use for the students (we don't have any active at the moment, but I'm expecting we will add
NoUnusedandSimplifyat some point).All changes from the elm code was suggested from those rules.
README
I wrote one.
Going live
We will need to merge that PR so we can check if the analyzer works as intended. You will get a comment if you use either
List.filterorList.filterMap.Maintaining the repo
At this point, I would like to request to become a maintainer on the Elm track, if I can get the blessing of @mpizenberg and @ceddlyburge.
I changed the
CODEOWNERfile so that we don't need admins to review each PR that don't touch the.githubrepo.