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.json #472

Merged
merged 2 commits into from
Sep 9, 2023
Merged

Add devcontainer.json #472

merged 2 commits into from
Sep 9, 2023

Conversation

AArnott
Copy link
Contributor

@AArnott AArnott commented Sep 8, 2023

This ensures that VS Code or GitHub Codespaces can automatically create an environment where cargo build and cargo test work.

Devcontainer (on its own)

VS Code supports these natively. So long as you have Docker running, it'll create a container and map the git repo you already have into it if you run the "Reopen in devcontainer" command. Then you'll have all the tools necessary to build and test this repo, independent of what you may (not) have available on your regular dev machine.

Codespaces

Codespaces leverage the devcontainer.json but adds value by hosting the container in the cloud for you. Learn more about GitHub Codespaces.

This root repo should consider setting up a prebuild of the Codespace to cache the docker image creation to make Codespace creation take just seconds.

For those using it, GitHub personal accounts can use Codespace VMs for free, to a point. Learn details here.
Note also that Codespaces VMs will sign your commits only if you have the repo set as a 'trusted' repo in your GitHub personal account settings.

You can see a sample of how Codespaces works by visiting the source branch of this PR and clicking the "<> Code" button:

image

Or use the ... button to configure the size of the Codespace VM. Give yourself a 16 core machine and see just how fast cargo build can go!

@AArnott AArnott force-pushed the devcontainer branch 3 times, most recently from 0bb2870 to 1a8e240 Compare September 8, 2023 14:17
@AArnott AArnott marked this pull request as ready for review September 8, 2023 14:17
@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.01% 🎉

Comparison is base (53d592b) 59.91% compared to head (1a8e240) 59.93%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #472      +/-   ##
==========================================
+ Coverage   59.91%   59.93%   +0.01%     
==========================================
  Files          33       33              
  Lines        5409     5409              
==========================================
+ Hits         3241     3242       +1     
+ Misses       2168     2167       -1     
Files Changed Coverage Δ
zingo-testutils/src/lib.rs 84.92% <ø> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.

📢 Have feedback on the report? Share it here.

@AloeareV
Copy link
Contributor

AloeareV commented Sep 8, 2023

This looks straight-forward, but I know very little about VSCode/devcontainers. @juanky201271 as far as I know you're the only one of us who's used tools along the lines of VSCode...if you have a couple minutes to sanity-check this I'd appreciate it!

@juanky201271
Copy link
Contributor

Maybe it's my local configuration, but when I try to open folder in container I got this error:
@AArnott

[2023-09-08T17:45:58.469Z]
[+] Building 1.0s (6/6) FINISHED
=> [internal] load build definition from Dockerfile-with-features 0.0s
=> => transferring dockerfile: 864B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/zingodevops/ci-build:001 0.5s
=> [dev_container_auto_added_stage_label 1/3] FROM docker.io/zingodevops 0.0s
=> CACHED [dev_container_auto_added_stage_label 2/3] RUN apt-get update 0.0s
=> ERROR [dev_container_auto_added_stage_label 3/3] RUN ln -s /usr/bin/l 0.5s

[dev_container_auto_added_stage_label 3/3] RUN ln -s /usr/bin/lightwalletd /u
sr/bin/zcashd /usr/bin/zcash-cli ./zingocli/regtest/bin/:
#0 0.456 ln: target './zingocli/regtest/bin/': No such file or directory


error: failed to solve: executor failed running [/bin/sh -c ln -s /usr/bin/light
walletd /usr/bin/zcashd /usr/bin/zcash-cli ./zingocli/regtest/bin/]: exit code:

@AArnott
Copy link
Contributor Author

AArnott commented Sep 8, 2023

@juanky201271 Thanks for testing. The relative paths in the Dockerfile work in a Codespaces container but not a local container I guess. Let me look more into this...

@AArnott AArnott marked this pull request as draft September 8, 2023 18:45
@AArnott AArnott marked this pull request as ready for review September 8, 2023 19:05
@AArnott
Copy link
Contributor Author

AArnott commented Sep 8, 2023

Ok, for me it works both in VS Code local dev containers as well as Codespaces.

Copy link
Contributor

@juanky201271 juanky201271 left a comment

Choose a reason for hiding this comment

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

It's working with VS in local... Great!

@juanky201271 juanky201271 merged commit fa55899 into zingolabs:dev Sep 9, 2023
17 checks passed
@AArnott AArnott deleted the devcontainer branch September 9, 2023 04:40
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.

4 participants