diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..4a73a36 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +{ + "name": "colcon-cache", + "image": "python:3", + "workspaceFolder": "/workspace/colcon-cache", + "workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind", + "onCreateCommand": ".devcontainer/on-create-command.sh", + "postCreateCommand": ".devcontainer/post-create-command.sh", + "features": { + "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": { + "packages": [ + "jq", + ] + }, + }, + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "ms-python.python" + ] + } + } +} diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh new file mode 100755 index 0000000..d28d605 --- /dev/null +++ b/.devcontainer/on-create-command.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Immediately catch all errors +set -eo pipefail + +# Uncomment for debugging +# set -x +# env + +git config --global --add safe.directory "*" + +COLCON_CI_URL=https://github.com/colcon/ci/archive/refs/heads/main.zip +curl -sSL $COLCON_CI_URL > /tmp/main.zip +unzip /tmp/main.zip -d /tmp/ +GITHUB_ACTION_PATH=/tmp/ci-main + +PKG_NAME=$(pip list -l -e --format json | jq '.[0].name' -r | tr _ -) +cp -a ${GITHUB_ACTION_PATH}/constraints{,-heads,-pins}.txt ./ +sed -i.orig "s/^${PKG_NAME}@.*//g" constraints-heads.txt +# Install dependencies, including 'test' extras, as well as pytest-cov +python -m pip install -U -e .[test] pytest-cov -c constraints.txt + +# cleanup temp files +rm constraints*.txt* diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh new file mode 100755 index 0000000..486724e --- /dev/null +++ b/.devcontainer/post-create-command.sh @@ -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 ~/ diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 9e2d116..0000000 --- a/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -.dockerignore -.git/ -.github/ -.gitignore -.vscode/ -Dockerfile diff --git a/.vscode/settings.json b/.vscode/settings.json index 9cd2784..96ad239 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,5 +10,16 @@ "sched", "subverb", "subverbs" - ] -} \ No newline at end of file + ], + "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 +} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 477dede..0000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM python:3 - -WORKDIR /usr/src/app - -COPY setup.cfg setup.py ./ -COPY colcon_cache/__init__.py ./colcon_cache/__init__.py -RUN pip install -e .[test] - -COPY . . -RUN pip install -e .[test] - -RUN colcon build \ - --symlink-install - -RUN colcon test && \ - colcon test-result --verbose