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 Dev Container for local development #39

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "colcon-clean",
"image": "python:3",
"workspaceFolder": "/workspace/colcon-clean",
"workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind",
"onCreateCommand": ".devcontainer/on-create-command.sh",
"postCreateCommand": ".devcontainer/post-create-command.sh",
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"ms-python.python"
]
}
}
}
20 changes: 20 additions & 0 deletions .devcontainer/on-create-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Immediately catch all errors
set -eo pipefail

# Uncomment for debugging
# set -x
# env

git config --global --add safe.directory "*"

CONSTRAINTS_URL=https://raw.githubusercontent.com/colcon/ci/main/constraints.txt
CONSTRAINTS_FILE=/tmp/constraints.txt

# Download constraints
curl -sSLo $CONSTRAINTS_FILE $CONSTRAINTS_URL
# Remove this package from constraints
sed -i "/^$(python setup.py --name)@/d" $CONSTRAINTS_FILE
Copy link
Member

Choose a reason for hiding this comment

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

I changed this line in colcon/ci#14 to support extensions that don't have a setup.py. You could copy the new logic here, or just drop in colcon-clean if you like.

# Install dependencies, including any 'test' extras, as well as pytest-cov
pip install -U -e .[test] pytest-cov -c $CONSTRAINTS_FILE
11 changes: 11 additions & 0 deletions .devcontainer/post-create-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# Immediately catch all errors
set -eo pipefail

# Uncomment for debugging
# set -x
# env

# Enable autocomplete for user
cp /etc/skel/.bashrc ~/
6 changes: 0 additions & 6 deletions .dockerignore

This file was deleted.

15 changes: 13 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,16 @@
"python.linting.pycodestyleEnabled": true,
"cSpell.words": [
"noqa"
]
}
],
"python.languageServer": "Default",
"python.testing.pytestArgs": [
"--cov",
"--cov-branch",
"--cov-report",
"xml:coverage.xml",
"--cov-config",
"setup.cfg"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
16 changes: 0 additions & 16 deletions Dockerfile

This file was deleted.