Skip to content

Add initial config for devcontainers. #689

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Egorrko
Copy link
Contributor

@Egorrko Egorrko commented Feb 7, 2025

Changes

  • Adding dev containers config allow contributors easily deploy project locally

Successful Workflow Run Link

PRs don't have access to secrets so you will need to provide a link to a successful run of the workflows from your own
repo.

  • Not needed

Checklist

  • Read the contribution guide and accept the
    code of conduct
  • Docs (If new inputs or outputs have been added or changes to behavior that should be documented. Please make a PR
    in the documentation repo)
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

Summary by CodeRabbit

  • New Features
    • Introduced a development container configuration that simplifies setting up a Node.js and TypeScript environment with automated Yarn dependency installation.
  • Documentation
    • Expanded contributor guidelines to include instructions for using development containers, ensuring a consistent and streamlined setup process for all users.

Copy link

coderabbitai bot commented Feb 7, 2025

📝 Walkthrough

Walkthrough

This update introduces a development container configuration file that sets up an environment with Node.js, TypeScript, and Yarn using a specified Docker image. It also defines a post-creation command to install dependencies via Yarn. In addition, the contribution guidelines have been updated with a new section on using development containers, providing instructions for installing necessary tools and reopening the repository in a container environment, along with minor formatting adjustments.

Changes

File(s) Summary
.devcontainer/devcontainer.json Added a new dev container configuration with properties: name ("Node.js & TypeScript & Yarn"), image ("mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm"), Node.js feature, and a post-create command ("yarn install").
CONTRIBUTING.md Introduced a "Development Containers" section detailing setup instructions for Docker Desktop, VS Code Dev Containers, cloning the repo, and reopening in a container, plus minor formatting adjustments.

Sequence Diagram(s)

sequenceDiagram
  participant D as Developer
  participant V as VS Code Dev Container
  participant DC as Docker Container
  D->>V: Open project in container mode
  V->>DC: Build container using .devcontainer config
  DC->>DC: Execute postCreateCommand ("yarn install")
  DC-->>V: Environment with Node.js, TypeScript, Yarn ready
  V-->>D: Container is ready for development
Loading

Poem

I'm a jaunty little rabbit, code hopping with glee,
In a container world where Node and TypeScript set me free.
Yarn spins the magic with each dependency install,
A box of Docker dreams now ready for one and all.
I celebrate these changes in a digital burrow so bright!
🐇💻 Happy coding from this curious bunny delight!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab4c1db and fae7560.

📒 Files selected for processing (2)
  • .devcontainer/devcontainer.json (1 hunks)
  • CONTRIBUTING.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • .devcontainer/devcontainer.json
  • CONTRIBUTING.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Tests

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Feb 7, 2025

Cat Gif

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
CONTRIBUTING.md (1)

42-61: Addition of the Development Containers section is clear and helpful.
The new section gives detailed, step-by-step instructions to set up a consistent development environment using dev containers. Consider adding a link to the official dev container documentation for those who want to dive deeper.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83c8532 and ab4c1db.

⛔ Files ignored due to path filters (4)
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
  • dist/licenses.txt is excluded by !**/dist/**
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • .devcontainer/devcontainer.json (1 hunks)
  • .github/workflows/activation.yml (1 hunks)
  • .github/workflows/build-tests-mac.yml (1 hunks)
  • .github/workflows/build-tests-windows.yml (3 hunks)
  • .github/workflows/cloud-runner-ci-pipeline.yml (2 hunks)
  • CONTRIBUTING.md (1 hunks)
  • package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/activation.yml
🔇 Additional comments (10)
.devcontainer/devcontainer.json (1)

1-10: Review of new devcontainer configuration: Basic structure looks good.
The container is named and tagged with a proper Node.js/TypeScript image, and the specified feature for Node.js appears correctly provided.

CONTRIBUTING.md (1)

38-41: General review of CONTRIBUTING.md formatting updates.
The existing sections have been maintained with only minor formatting improvements.

.github/workflows/build-tests-mac.yml (1)

58-63: UNITY_LICENSE environment variable added correctly.
The newly added environment variable on line 62 aligns with the PR objective and is consistently formatted with the other secrets. Ensure that the corresponding secret is properly configured in the repository’s settings.

package.json (1)

31-32: Dependency version updates are noted.
Upgrading "@actions/cache" to "^4.0.0" and "@actions/core" to "^1.11.1" should help keep the workflows up to date with recent improvements. Please verify that these new versions are fully compatible with the rest of the CI setup and that all workflow steps have been tested.

.github/workflows/build-tests-windows.yml (3)

65-69: Consistency check for UNITY_LICENSE on Windows build step.
The addition of UNITY_LICENSE on line 68 ensures that the Windows build environment receives the same secret as the MacOS configuration. This is consistent and clear.


89-94: Verification of UNITY_LICENSE on the first retry build step.
The inclusion of UNITY_LICENSE on line 93 for the first retry is appropriate. Double-check that all secrets are set for every step that uses them to avoid intermittent build issues.


113-118: Verification of UNITY_LICENSE on the second retry build step.
Similarly, adding UNITY_LICENSE on line 117 ensures that all fallback build attempts have access to the Unity license, which maintains consistency across the workflow.

.github/workflows/cloud-runner-ci-pipeline.yml (3)

193-196: Enhancement: Added AWS and Token Environment Variables in Unity Build Step

The new environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, GIT_PRIVATE_TOKEN, and GITHUB_TOKEN) have been added within the "unity-build" step of the buildTargetTests job. This ensures that the build has access to necessary credentials and tokens for AWS and Git operations. Please verify that these secrets are defined in your repository settings and that similar changes (if any) in other workflow files are consistent.


203-204: Review: CP Command Formatting Change

There is a minor change indicated by a "~" following the cp command that copies the build artifact from the cache. It appears to be a formatting or a minor whitespace update. Please confirm that this change is intentional and that the cp command correctly handles the source and destination paths in your CI environment.

🧰 Tools
🪛 actionlint (1.7.4)

203-203: property "cache_key" is not defined in object type {androidversioncode: string; buildversion: string; engineexitcode: string; volume: string}

(expression)


205-209: Upgrade: Artifact Upload Action to v4

The actions/upload-artifact action has been updated from v3 to v4. This upgrade should provide performance improvements and the latest features. Ensure that this new version is compatible with your workflow configurations across all jobs—especially given the coordinated updates in other CI files—and test that no unintended breaking changes occur.

🧰 Tools
🪛 actionlint (1.7.4)

208-208: property "build_artifact" is not defined in object type {androidversioncode: string; buildversion: string; engineexitcode: string; volume: string}

(expression)

Comment on lines +7 to +9
"postCreateCommand": {
"Install dependencies": "yarn install"
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Verify the format of postCreateCommand.
The current format uses an object with a label ("Install dependencies") mapping to the command. According to standard devcontainer.json schema, postCreateCommand is typically defined as a string or an array of strings. Consider revising it to a simpler format, for example:

-  "postCreateCommand": {
-    "Install dependencies": "yarn install"
-  }
+  "postCreateCommand": "yarn install"

This change helps ensure compatibility with standard dev container tooling.

@webbertakken
Copy link
Member

If this is just for installing Node and Yarn, then we already use Volta.

Have you considered using Volta as prescribed?

Can you speak for the upsides of using devcontainer instead? What needs to be installed to use the config?

@Egorrko
Copy link
Contributor Author

Egorrko commented Feb 7, 2025

Have you considered using Volta as prescribed?

I followed the instructions from CONTRIBUTING.md.

Can you speak for the upsides of using devcontainer instead? What needs to be installed to use the config?

Des containers allows you to deploy a project and its dependencies in a docker container without installing anything on the host system.

What needs to be installed to use the config?

Only docker and compatible ide (vscode for me)

Is it possible to test locally that the code successfully builds unity projects?
I've been experimenting with act, which allows you to run github actions locally.

@davidmfinol
Copy link
Member

davidmfinol commented Feb 8, 2025

Is it possible to test locally that the code successfully builds unity projects? I've been experimenting with act, which allows you to run github actions locally.

Yes, you should be able to run with act (though it's been a long time since I last did it)

Copy link

codecov bot commented Feb 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.00%. Comparing base (3ae9ec8) to head (fae7560).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #689   +/-   ##
=======================================
  Coverage   37.00%   37.00%           
=======================================
  Files          77       77           
  Lines        3129     3129           
  Branches      646      646           
=======================================
  Hits         1158     1158           
  Misses       1828     1828           
  Partials      143      143           

Copy link
Member

@davidmfinol davidmfinol left a comment

Choose a reason for hiding this comment

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

I haven't used dev containers, but I'm in support of providing the option for it.

@webbertakken
Copy link
Member

I'm not super against this approach per se.

However, I'm not sure if a much heavier stack (i.e. you now docker and an IDE extension, just to work with the repo) is helpful here. Especially since if you want the action to eventually run locally, you in addition need dind or docker service to run on the side - because it isn't always trivial to run a docker container from within another docker container. And I'm not sure how much dev containers support that kind of thing.

When looking at this PR I'm also not sure about these points:

  • The devcontainer config name looks very generic and not specific to this repository
  • Not everyone uses VSCode, is this really as plug and play it sounds?
  • This PR introduces this new not-battle tested option as the default from the start
  • Does this in fact use the correct version of yarn?
  • And perhaps should it use volta, to at least keep the versioning in sync?

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.

3 participants