-
Notifications
You must be signed in to change notification settings - Fork 13
update to use typescript + tool-cache #2
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
|
@alexcb do you have any cycles to take a peek at this? |
alexcb
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.
Thanks for the PR -- it's a rather big change -- switching languages.
if src/setup-earthly.js is no longer needed, can it be deleted?
Can you move the tests into our Earthfile -- so we can use earthly to test it rather than act.
|
@alexcb The latest commit should address all of your concerns except the last one. I added a I can try adding something like latest:
name: Test Latest Version Install
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-earthly@v1 # < installs earthly
- run: earthly +compile
- uses: ./ # < installs earthly again
- run: earthly --versionbut the test will still be having github actions import the build file and run it by itself which is what will happen with consumers of the action (i.e. what we should test). We also have a bootstrapping problem where we will always test the previous released version of the action instead of the current one which you can see in the previous example if we wanted to test actions/setup-earthly@v2 for instance. Let me know if those comments / concerns make sense. |
|
Thanks for the updates @kevinschoonover
I tried adding a new earthly target: test-run:
FROM +npm-base
COPY --dir +compile/dist .
ENV RUNNER_TOOL_CACHE=/tmp/cache-dir
RUN node dist/index.js
RUN earthly --version # this currently fails due to earthly not being installed on the pathwith the hopes of running the actions code directly in earthly, which should result in installing earthly-in-earthly. But I quickly discovered earthly is no longer installed to the same location (and as a result isn't on my cache). I've never used tool-cache before, but I quickly discovered all I need to do is set Perhaps this is where we can run I see and I can verify the file was downloaded and cached to: However, when I re-run The time value has changed (from This makes it look like the file isn't being cached correctly. Can you elaborate on the expected behaviour of tool-cache? |
|
I did some digging into this a couple days ago because I was experiencing the same behavior. It seems tool-cache is for self hosted runners. There is a different sdk that does the caching we expect. I have a branch on my fork called 'caching' which implements real caching. Dont know if we want to include that in this PR or follow up. However it'll add a wrinkle to the running it directly in earthly because it requires special environment variables and running another .js file. I can look into what you're mentioning above tonight |
|
https://www.npmjs.com/package/@actions/tool-cache makes reference to a |
|
Happy to implement this, but each github action runner is on a fresh install so I don't think we will see any benefit from it except on local/self hosted runs. |
|
@alexcb I added both toolcache and the github action caching so we should now effectively have 2-tiers of cache:
On your point about moving on the integration tests from which seem to be a pretty standard practice for testing actions:
the problem with dind + act is that act doesn't support all of githubs features like caching and my not reflect what the actual github runner will do for the various platforms (linux, macos, windows). Moreover, I think the problem you're having with earthly not being in the path is because the actions SDK emits a command that is picked up by the runner to actually change the system path and only actually affects the process's path. I'm happy to add an extra test to earthly which will compile and run the code like you were talking about above in addition to these tests if thats a good compromise? |
alexcb
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.
thanks for the caching work -- I did a few tests and it appears to be working.
I'll handle this. Thanks for the contribution. |
Hey Folks!
I was working on this tangentially for https://github.com/bloominlabs/setup-earthly/ and I didn't realize this was being made from the current docs!
I took a lot of inspiration (i.e. a lot of the source code) from the setup-pulumi and this gives the action:
and was wondering if you were interested in upstreaming the code?