-
Notifications
You must be signed in to change notification settings - Fork 32
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 Dev Container configuration #90
base: master
Are you sure you want to change the base?
Conversation
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! I haven't tested this yet, but will try to do it once it's merged.
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 would omit this file: we don't have any .cmd/.bat files and I don't like using text=auto
. So unless we really need it, let's just use the EOLs of the files in the repository which should already be LF.
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 added this mainly for at least the * text=auto eol=lf
part, since I ran into issues with git running inside of VS Code codespace terminals running on local Windows converting everything to CRLF for some reason.
I think it might have something to do with Dev Container support for inheriting various local environment settings into the container environments, though I'm not sure.
In any case, I want that first line at least to help prevent PRs being created that perform those conversions, even if git is configured incorrectly on the client side.
I'm fine removing the bat/cmd lines though. You're right, I doubt we ever add those to this repo.
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 guess it should also fix the issue with just * eol=lf
alone, without text=auto
. I'll try just that.
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.
Nope, doesn't work without text=auto
. This results in changes to binary files.
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.
Are they really converting all files by default?? This would seem to be an incredibly stupid thing to do, so I can't quite believe it, but why else would this happen?
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 don't think it's explicitly converting them. I just think it's probably checking out files as CRLF due to inheriting some local environment settings from the Windows host into the Dev Container, but then maybe new terminals or some operations don't also get those, and think the file is modified?
I'm not really certain the cause, but I believe adding this ensures that it does check out files as LF on all Windows environments as well, thus avoiding the issue entirely.
I originally found this approach from a VS Code FAQ covering Dev Containers. It seems like this is a common issue that comes up.
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 have actually struggled with this in the past when using my GitHub Desktop clone of the website repo on Windows for what it's worth, and I imagine this would fix that as well.
How do you normally work on this repo out of curiosity?
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 know that this is a common issue but I think it only happens when people enable auto conversion when installing Git, i.e. enable it in the global gitconfig
. I never do this (and think it's a huge mistake to do it), but if this is indeed the case, then I guess this is the right thing to do.
This adds a new Dev Containers configuration that's compatible with GitHub Codespaces, that contains a fully functional development environment for working on the wxWidgets website.
This is an alternative approach to Vagrant, which can be run not just in Codespaces, but other Dev Container compatible environments like CodeSandbox, as well as locally in Docker Desktop. Though using Codespaces is certainly the easiest out of the box, and doesn't require installing a single thing.
This includes:
The
WX_SITE_DIR
environment variable is configured in this environment, the same way it is for the Publish GitHub action we have. So all scripts properly setup to use that work just the same.Unlike the old Vagrant environment, this development environment actually does properly support file watchers for Jekyll. So any changes to most files will automatically be picked up and regenerated.
Only Jekyll is configured to run continuously after booting up, since it supports file watchers. All other aspects need to be manually re-run in terminal if required for changes, such as regenerating translation stats, download stats, and re-compiling assets.
To see this in action, just spin up this pull request in Codespaces. By default, it will open in VS Code for Web, but this can be configured to open in natively running VS Code on desktop by updating your personal GitHub settings (see "Editor preference"). Wait until you see a notification for "Your application running on port 4000 is available." with a "Open in Browser" button, which indicates that Jekyll has started up and is serving the application. It may still take a few seconds for assets to finish compiling and for Jekyll to pick them up and copy them over. If assets don't load properly right away, just give it a moment and refresh.
Once this pull is merged, we can also enable a Codespaces prebuild, which will cache a development image that includes almost everything except the final few custom steps that build assets, translations, download stats, and initial Jekyll build. This is enough to spin up a fully functioning wxWidgets website in development in just under 2 minutes from scratch.