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

docs: Improve tool description #2

Merged
merged 1 commit into from
Dec 17, 2023

Conversation

hyperupcall
Copy link
Collaborator

This improves the tool description, so there are no expectations that this tool installs Git (it does not look like it does, reading src/main.ts. The repository description may need to be changed as well.

Copy link
Member

@jcbhmr jcbhmr left a comment

Choose a reason for hiding this comment

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

Good call!
I've added you to the repo. You can merge your own PR! 🎉

@jcbhmr
Copy link
Member

jcbhmr commented Dec 17, 2023

this got me thinking: is there any situation in a given GitHub Actions runner where you'd need to actually install git? when I made this action i obviously didn't think so but now im reconsidering:

what if you're in a container that doesn't have git? is that possible? likely? unlikely?

any other circumstances? idk

natural follow up: should this action install git? idk

@hyperupcall
Copy link
Collaborator Author

hyperupcall commented Dec 17, 2023

Yeah - not all containers have Git installed, and I believe Git may not also be installed if running jobs in a Windows host. I suppose, it is relatively uncommon to do this, but usually I do expect a GitHub setup-* action to install something.

I don't know if this action should install Git either - I like this action because it properly configures Git for CI, but I don't think I would use it if it tried to actually install Git (I would want to use whatever version is on the system).

If this tool were named something like setup-git-config, then I suppose that would make the purpose of this tool a bit more clear. But I'm not sure how warranted or needed a rename is, though.

@hyperupcall
Copy link
Collaborator Author

hyperupcall commented Dec 17, 2023

Thanks for the invite - I have accepted and will merge this PR :)

@hyperupcall hyperupcall merged commit 6f49171 into actions4git:main Dec 17, 2023
3 checks passed
@jcbhmr
Copy link
Member

jcbhmr commented Dec 17, 2023

howabout this:

  • installs git.
  • defaults "version" to "system" similar to what actions/setup-python does

The python-version input is optional. If not supplied, the action will try to resolve the version from the default .python-version file. If the .python-version file doesn't exist Python or PyPy version from the PATH will be used. The default version of Python or PyPy in PATH varies between runners and can be changed unexpectedly so we recommend always setting Python version explicitly using the python-version or python-version-file inputs.

https://github.com/actions/setup-python

this would also have the side-effect of allowing a user to specify a version input to install a specific version of git 🎉

the real question is: how do you actually install git lol

ideas (mostly from https://github.com/git-guides/install-git):

  1. use sudo apt-get install git on debian-based containers (idk how youd pick a version)
  2. somehow on windows automatically run https://gitforwindows.org/ installer? idk how to do that without a GUI to click the Next button. is there a cli that you know of to do that?
  3. somehow get prebuilt git binaries? the https://github.com/git/git/releases doesn't have any (though there are a lot of tags, just no releases with binaries attached)

actually just found https://git-scm.com/downloads which might be what i want?
looks like they have a versioned URL like https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/PortableGit-2.43.0-64-bit.7z.exe which could work

@hyperupcall
Copy link
Collaborator Author

hyperupcall commented Dec 17, 2023

That's reasonable - only install git if we specify the version. However, as far as I know, pre-built binaries of Git are not available for Linux. It looks like git-for-windows does have pre-built binaries (and an installer). But we have to figure out how to solve this for Linux first.

Looking how other places solved this problem:

  • PHP doesn't offer pre-built assets, but there was a company that did offer pre-built artifacts for different Linux distributions. I'm not certain if setup-php uses this
  • Python doesn't offer pre-built assets, but this page seems to suggest that GitHub actions runner already takes care of that
  • Ruby doesn't offer pre-built assets, and to solve this, they created ruby-builder (setup-ruby uses this)

Something like Ruby-builder seems like a good approach, if we want this action to Install git. What do you think?

@jcbhmr
Copy link
Member

jcbhmr commented Dec 18, 2023

UNRELATED: after more research: theres this weird pairing where python and nodejs have setup-* and *-version repos 🤔
There's a manifest file in each of the actions/*-versions repos and then that gets used by the actions/setup-* action to download the released artifacts and use them. https://github.com/actions/setup-python/blob/e9d6f990972a57673cdb72ec29e19d42ba28880f/src/install-python.ts#L11

https://github.com/actions/python-versions => https://github.com/actions/setup-python
https://github.com/actions/node-versions => https://github.com/actions/setup-node

that might be a bit overcomplicated lol


you're right there's no actions/ruby-version repo so they use ruby-builder 👍
do you know if there's a git-builder or similar?


after MORE research lol i got this:

When you have all the necessary dependencies, you can go ahead and grab the latest tagged release tarball from several places. You can get it via the kernel.org site, at https://www.kernel.org/pub/software/scm/git, or the mirror on the GitHub website, at https://github.com/git/git/tags. It’s generally a little clearer what the latest version is on the GitHub page, but the kernel.org page also has release signatures if you want to verify your download.

Then, compile and install:

$ tar -zxf git-2.8.0.tar.gz
$ cd git-2.8.0
$ make configure
$ ./configure --prefix=/usr
$ make all doc info
$ sudo make install install-doc install-html install-info

After this is done, you can also get Git via Git itself for updates:

$ git clone https://git.kernel.org/pub/scm/git/git.git

https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

so it looks relatively straightforward. just put that in a .github/workflows/whatever.yml and in an actions4git/git-builder or similar and tada now you get releases of Git? right?

@hyperupcall
Copy link
Collaborator Author

@jcbhmr Nice research! - I did not know about actions/{python,node}-versions.

that might be a bit overcomplicated lol

Yeah those are my thoughts too. If we just fork it and change some variables, then it might not be too bad

you're right there's no actions/ruby-version repo so they use ruby-builder 👍
do you know if there's a git-builder or similar?

I could not find a git-builder or git-version - if there was one, there probably would be another setup-git repository, too.

so it looks relatively straightforward. just put that in a .github/workflows/whatever.yml and in an actions4git/git-builder or similar and tada now you get releases of Git? right?

There are some details that might need some thinking about. For example, if we create pre-compiled binaries, and if we naively use the ubuntu-22.02 runner, then our binaries are likely to break under older Linux distributions that use an older version of libc. There might be some other issues that would require creating a build for each major distribution - I'm not sure. When building, I really don't think we should use --prefix=/usr - better would be to do --prefix=/usr/local. But we have to think more about it - because say if we are uploading tarballs as artifacts, we can't just include everything in /usr/local, since there is other stuff besides Git

@hyperupcall
Copy link
Collaborator Author

I've been meaning to create a general solution for this pre-built binaries problem. In asdf, plugins for PHP and Python will just build every single version (since no pre-built binaries are available). rtx, which uses asdf plugins has this same problem. I've reserved the GitHub organization pre-built for this use for the future, but I'm not sure when I'll get the time to work on it

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.

2 participants