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

feat: Add dev container #1060

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

tschaffter
Copy link
Member

@tschaffter tschaffter commented Dec 16, 2022

Fixes #1059

Changelog

  • Add the definition of a dev container that includes Python and Poetry among other tools.
  • Add the folder tools/ with the script required to build the dev container image sagebionetworks/schematic-devcontainer.
    • See section "Future work" below.
  • Define workspace-* commands in dev-env.sh.
    • E.g. workspace-install to install the project dependencies.
  • Add a badge to the README to enable developers to start the development environment with VS Code with a single click (click > VS Code starts the dev container > developer is ready to develop).
    • This badge will only work once this PR is merged to the base branch.

Preview

Develop inside the dev container with VS Code

  1. Launch VS Code
  2. Install the VS Code extension Dev Containers
  3. Open the folder of this repository
  4. Checkout the branch behind this PR
  5. Open the Command Palette (Ctrl+Shift+P)
  6. Type "dev" > select "Dev Containers: Open Folder in Container..." > OK
  7. You are now inside the dev container with all the tools required to contribute to this project.
    • Try python --version and poetry --version

image

Develop inside a GitHub Codespace

GitHub Codespace is a new feature that was released in November 2022. It relies on the dev container standard to spin up a development environment for projects that include a dev container definition. You can try starting a GH Codespace using the branch behind this PR.

  1. Go to https://github.com/tschaffter/schematic/tree/add-devcontainer
  2. Click on the Code button
  3. Click on the tab "Codespaces"
  4. Click on the button "Create codespace on add-devcontainer" (add-devcontainer is the name of the branch).
  5. You are now inside the codespace

image

image

Future Work

  • Build and publish the dev container image with a GitHub workflow.
  • Update CI/CD workflows to perform operations inside the dev container.

@tschaffter tschaffter marked this pull request as draft December 18, 2022 01:07
@tschaffter
Copy link
Member Author

This PR does not change the code of schematic so I'm not sure why the tests are failing.

@tschaffter tschaffter marked this pull request as ready for review December 19, 2022 16:45
@milen-sage
Copy link
Collaborator

@tschaffter I think tests fail because the request is from a different fork. I wouldn't worry about that, unless you'd like to :)

@milen-sage
Copy link
Collaborator

Just to confirm, @tschaffter the goal of this request - in addition to the various other features of the dev container - is to speed up CI/CD actions?

@milen-sage
Copy link
Collaborator

milen-sage commented Dec 20, 2022

@GiaJordan could you review this PR? I think we can evaluate it and merge it next year (i.e. not urgent for the holidays :)

@tschaffter
Copy link
Member Author

the goal of this request - in addition to the various other features of the dev container - is to speed up CI/CD actions?

@milen-sage Yes, among other benefits to your team.

@tschaffter
Copy link
Member Author

Following a discussion with Milen, I should have the chance to present to the FAIR Data team the benefits of developing inside a dev container early next year.

@thomasyu888
Copy link
Member

This could be a good retrospective topic to implement this as a practice when developing

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.

Uniformize developer experience using Visual Studio Code Dev Containers
3 participants