Skip to content

Commit

Permalink
Add Dev Container for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
ruffsl committed May 5, 2024
1 parent 842696e commit 7da05f1
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 24 deletions.
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
# 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 @@ -10,5 +10,16 @@
"sched",
"subverb",
"subverbs"
]
}
],
"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.

0 comments on commit 7da05f1

Please sign in to comment.