Skip to content

Added .devcontainer for GitHub Codespaces. #300

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

Merged

Conversation

dlemstra
Copy link
Contributor

@dlemstra dlemstra commented Aug 8, 2022

Description

This pull requests adds a devcontainer configuration that will be used when a codespace is started in this repository. This configuration installs the packages that are required to run the unit tests of this project. And it also uses the $GITHUB_TOKEN variable that is available in a codespaces to create the .env file that is used by the unit tests. I have also added a file called first-run-notice.txt that will be shown when the codespace is started. It might need some more improvements but I will leave that up to the maintainers of this project.

When trying to get composer test to work I also noticed that I needed different packages to make it work. I don't have enough php experience to know what to change in the composer.json file or README.md so I will leave that up to the maintainers of this projects.

Type of change

  • New feature (added a non-breaking change which adds functionality)

How Has This Been Tested?

  • Ran tests with composer test

Checklist:

  • I have checked to make sure no other pull requests are open for this issue
  • The code is properly formatted and is consistent with the existing code style

@dlemstra
Copy link
Contributor Author

dlemstra commented Aug 8, 2022

I created this .devcontainer because the image that is created does not seem to contain the correct information:

GitHub Streak

I started in opensource in 2013 but the image starts in 2015? But when I tried to create a unit test to check why this was failing in the GitHub codespace I was unable to reproduce this issue. Is the version running on the herokuapp using an older version then the main branch?

Copy link
Owner

@DenverCoder1 DenverCoder1 left a comment

Choose a reason for hiding this comment

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

This is really neat! Thanks for your help on this 👍 I tried it out on your branch and it is looking pretty good. I had some issues trying to run it with composer start though (the address generated for the port was giving a 502 error), but overall it seems nice. I especially like the creation of the .env and usage of the first run notice.

ADD first-run-notice.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt

RUN apt-get update -y && \
apt-get install -y php php-curl php-imagick php-xml composer
Copy link
Owner

Choose a reason for hiding this comment

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

The documentation hasn't been updated yet, but php-imagick is no longer used by the project and inkscape can be added here instead.

Imagick was originally added for converting SVG to PNG, but while it worked perfectly locally, there were several issues when it came to getting it to work on Heroku. At first (#149), there were errors about unknown decode delegates and then MVG policy issues, eventually those were resolved but it still rendered weirdly (#217) and then stopped working entirely, just producing a blank background (#293). I tried using several Heroku buildpacks for overriding the ImageMagick version, changing the policy, etc, but couldn't get anything to work. I noticed that you've worked on ImageMagick, so maybe you have some idea about this.

In any case, imagick is no longer a dependency at least until I can figure out how to make it work on Heroku, and inkscape is a new dependency (#298) that I was able to get to work for rendering PNGs locally and on Heroku.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My recommendation would be to use inkscape in your situation. I had to install these packages to make composer install work because it looks like the composer.json file still requires this? Maybe that should be changed before this PR gets merged? But also feel free to change that after merging this PR.

Copy link
Owner

@DenverCoder1 DenverCoder1 Aug 9, 2022

Choose a reason for hiding this comment

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

It should be resolved in #301. If you'd like, you can update the base branch so you can make it no longer required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, saw that you just did. Now testing what I need to install in a separate branch. Will update the PR after I am done testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pull request has been updated.

@DenverCoder1
Copy link
Owner

I started in opensource in 2013 but the image starts in 2015? But when I tried to create a unit test to check why this was failing in the GitHub codespace I was unable to reproduce this issue. Is the version running on the herokuapp using an older version then the main branch?

This seems to me like an issue on GitHub's end. The contribution years are requested from the GitHub API and it seems like it just returns from 2015.

Similarly, it seems to stop here on your profile page.

image

The Heroku app is up to date with the main branch, I think it's just the GitHub API being inconsistent. I've experienced similar issues with it in the past.

@dlemstra
Copy link
Contributor Author

dlemstra commented Aug 9, 2022

That's interesting and explains why this is happening. For me it starts in 2013 and that is why I was unable to reproduce it.

afbeelding

@DenverCoder1
Copy link
Owner

That's interesting and explains why this is happening. For me it starts in 2013 and that is why I was unable to reproduce it.

Very strange, I suppose if you self host it with your own access token, it might work more accurately for you. As far as I can tell, there isn't much I can do about it since it seems to be an issue with the response from GitHub.

@dlemstra
Copy link
Contributor Author

dlemstra commented Aug 9, 2022

I am not actually planning to use this image anywhere but I saw it somewhere and noticed that it started at the wrong year so that is why I came here to try and help fix it. But it does look like there is nothing to fix.

@dlemstra dlemstra force-pushed the add-codespaces-devcontainer branch from 12ffafc to 3087db3 Compare August 9, 2022 06:05
Copy link
Owner

@DenverCoder1 DenverCoder1 left a comment

Choose a reason for hiding this comment

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

Looks like this should be a great start! Thanks for the contribution 🎉

@DenverCoder1 DenverCoder1 merged commit 9237db5 into DenverCoder1:main Aug 9, 2022
@dlemstra dlemstra deleted the add-codespaces-devcontainer branch August 9, 2022 12:52
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