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

Add devcontainer/codespace config #857

Merged
merged 8 commits into from
Nov 13, 2022
Merged

Add devcontainer/codespace config #857

merged 8 commits into from
Nov 13, 2022

Conversation

spenserblack
Copy link
Collaborator

This should allow contributors to use GitHub codespaces to contribute to onefetch.

@o2sh
Copy link
Owner

o2sh commented Nov 12, 2022

Thanks @spenserblack - just found out about GH codespaces thanks to you 👍

We may need to add a few things to make it a more "self-sufficient" dev container, I'm thinking of the tooling for onefetch.dev -> node, npm, svelte extensions...

This can be done in the future and shouldn't block this PR.

@spenserblack
Copy link
Collaborator Author

We may need to add a few things to make it a more "self-sufficient" dev container, I'm thinking of the tooling for onefetch.dev -> node, npm, svelte extensions...

Great idea! I still have a lot more to learn, but I think it's possible to have multiple dev container configurations per repo. So potentially one can have a codespace for onefetch, and one for onefetch.dev.

@spenserblack
Copy link
Collaborator Author

Oh, BTW, might want to check out the prebuild setting.

More reading: https://docs.github.com/en/codespaces/prebuilding-your-codespaces

@o2sh
Copy link
Owner

o2sh commented Nov 13, 2022

So potentially one can have a codespace for onefetch, and one for onefetch.dev.

That's right, I'll create a separate dev container config under docs/vercel with the right tooling.

Oh, BTW, might want to check out the prebuild setting.

I'll definitely set that up 👍

@o2sh o2sh merged commit 944ce50 into o2sh:main Nov 13, 2022
@spenserblack
Copy link
Collaborator Author

Does the simplified devcontainer (50bb474) work for you? For me it fails on libz-sys

...
--- stderr
  thread 'main' panicked at '
  failed to execute command: No such file or directory (os error 2)
  is `cmake` not installed?

o2sh added a commit that referenced this pull request Nov 14, 2022
@o2sh
Copy link
Owner

o2sh commented Nov 14, 2022

Yes, I'm really sorry about that, I should have tested it before pushing it --> I just reverted it 7cc7db5

BTW, another issue when running cargo run

Error: config value 'safe.directory' was not found; class=Config (7); code=NotFound (-3)

We may need to add git config --global --add safe.directory /workspaces/onefetch to the Dockerfile

@spenserblack
Copy link
Collaborator Author

spenserblack commented Nov 14, 2022

We may need to add git config --global --add safe.directory /workspaces/onefetch to the Dockerfile

I think that's probably best put in a postCreate command. Probably don't need an image layer for a config change.

// .devcontainer/devcontainer.json
// ...
"postCreateCommand": ".devcontainer/postCreate.sh",
// ...
#!/bin/bash
# .devcontainer/postCreate.sh
git config --global --add safe.directory $PWD
# etc.

I should have tested it before pushing it

I didn't know this at first (which is why I was pushing everything to my fork's main branch), but you can create codespaces from configs on other branches. You just need to have switched to that branch in the web UI before creating the new workspace. Seems so simple in hindsight 😆

@o2sh
Copy link
Owner

o2sh commented Nov 14, 2022

Thanks for the help, if it's just for one command, I think we can skip the shell script and put the it directly in the .json file c9e8223

@spenserblack
Copy link
Collaborator Author

spenserblack commented Nov 28, 2022

@o2sh FYI: https://github.com/orgs/community/discussions/39697

One thing I noticed is that prebuilds count against your storage. Perhaps you want to disable and delete prebuilds (knowing that they're billable, they only seem worth it for orgs TBH 🤷)

@o2sh
Copy link
Owner

o2sh commented Nov 28, 2022

One thing I noticed is that prebuilds count against your storage.

I guess that explains all the notifications I was getting from GH telling me to increase my Codespaces storage usage 😅

I'll delete them, thanks for letting me know @spenserblack

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.

None yet

2 participants