Skip to content
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

start #1

Merged
merged 6 commits into from
Jun 5, 2019
Merged

start #1

merged 6 commits into from
Jun 5, 2019

Conversation

bryanmacfarlane
Copy link
Member

Starting with code from Danny and I

See docs/contributors for details on what's checked in and not

toolkit is added as tgz files for now since not public yet

@bryanmacfarlane
Copy link
Member Author

more work to do and tests needed. getting directional feedback early

@@ -0,0 +1,6 @@
# runtime dependencies are checked in
# dev dependencies are *not* checked in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't have to be part of this initial PR, but maybe we should just webpack as part of our build process. Then we can just ignore node modules

Copy link
Contributor

@damccorm damccorm Jun 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note also - this also doesn't really work to not check in dev dependencies. While this doesn't check in the top level dev-deps, nested dependencies will still get checked in. For example, Prettier alone has ~60 dependencies all of which get checked in (not to mention the dependencies of those dependencies).

I think webpack is probably the best path forward here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we doing this to avoid having to npm install the production dependencies of this tool? If so, there are a few options for vendoring in dependencies that we already use at GitHub. If you can give me a sense of the goal with this, I can advise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runner will run the action from the github graph at runtime per the execution model. That is, it will get the targz of that ref and run it.

Dependencies are vendored in as you noted.

@damccorm - regarding dev dependencies, you can use npm prune before you publish (push).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool - didn't know about npm prune. It looks like that handles all devDependencies though, so we probably don't need those listed in gitignore. It also might be good to enforce that with something like husky

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #5 proposing using husky

src/installer.ts Outdated
throw new Error('Expected Agent.TempDirectory to be set');
}

let _7zPath = path.join(__dirname, '7zr.exe');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, we're not doing anything with this. With that said, we do need to bundle our own version of 7zr.exe to avoid path-too-long issues (I was running into them installing node 10 with this code). I'll need to add support for that in actions/tool-kit/tool-cache as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed that in my tool-cache PR and here as well.

src/installer.ts Outdated
try {
downloadPath = await tc.downloadTool(downloadUrl);
} catch (err) {
if (err['httpStatusCode'] && err['httpStatusCode'] === '404') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we're not returning the status code like this so this will fail. I should update actions/toolkit/tool-cache to do this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to my tool-cache PR, not packed into this one yet though so tests will still fail for now.

Copy link

@jclem jclem Jun 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the change from this comment is implemented in tool-cache, you can check err instanceof HTTPError && err.httpStatusCode === 404 (I think it's actually a number, but not 100% on that).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I think you can actually cheat here, since err is always any, I believe. You can just check err.httpStatusCode === 404.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to consume the more recent tool-cache and this works now. Went with
err instanceof HTTPError && err.httpStatusCode == 404
I thought loose equality to a number was best here just in case this ends up getting attached as a string down the line for some reason

@damccorm damccorm mentioned this pull request Jun 4, 2019
Copy link

@jclem jclem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directionally, looks fine. As far as structuring the package is concerned, I have a few questions:

  • I don't think we need to check in the compiled code, do we? We can build the TypeScript and push the JS output to npm without actually checking the output into the repository (npm doesn't actually understand git, .gitignore, etc).
  • Is there a reason we vendor in these dependencies instead of installing them?

@@ -0,0 +1,6 @@
# runtime dependencies are checked in
# dev dependencies are *not* checked in
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we doing this to avoid having to npm install the production dependencies of this tool? If so, there are a few options for vendoring in dependencies that we already use at GitHub. If you can give me a sense of the goal with this, I can advise.

@bryanmacfarlane
Copy link
Member Author

@jclem - yes, we need to check in the compiled code since actions are run from the github graph. The runner gets the action targz at the ref and runs it. That's also the reason runtime dependencies are vendored.

@damccorm
Copy link
Contributor

damccorm commented Jun 5, 2019

Merging since it sounds like we're on the same page for this right now. We can reopen discussion as appropriate

@damccorm damccorm merged commit 3b7fa72 into master Jun 5, 2019
@damccorm damccorm deleted the features/start branch June 7, 2019 19:22
krzyk pushed a commit to krzyk/setup-node that referenced this pull request Apr 11, 2023
deining pushed a commit to deining/setup-node that referenced this pull request Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants