From 5a90902990de1fe2c767211fd32953f3ae87cd6d Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 3 Nov 2023 19:02:47 -0400 Subject: [PATCH 1/8] Stage WIP in adding devcontainer --- .devcontainer/devcontainer.json | 26 +++++++++++++++++++++++++ .devcontainer/on-create-command.sh | 21 ++++++++++++++++++++ .devcontainer/post-create-command.sh | 13 +++++++++++++ .devcontainer/update-content-command.sh | 15 ++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100755 .devcontainer/on-create-command.sh create mode 100755 .devcontainer/post-create-command.sh create mode 100755 .devcontainer/update-content-command.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..7f21241 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +{ + "name": "colcon-clean", + "build": { + "dockerfile": "../Dockerfile", + "context": "..", + "target": "builder" + }, + "workspaceFolder": "/usr/src/app", + "workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind", + "onCreateCommand": ".devcontainer/on-create-command.sh", + "updateContentCommand": ".devcontainer/update-content-command.sh", + "postCreateCommand": ".devcontainer/post-create-command.sh", + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "eamodio.gitlens", + "esbenp.prettier-vscode", + "GitHub.copilot", + "streetsidesoftware.code-spell-checker", + "dirk-thomas.vscode-empy", + "ms-python.python" + ] + } + } +} \ No newline at end of file diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh new file mode 100755 index 0000000..154a3b2 --- /dev/null +++ b/.devcontainer/on-create-command.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Immediately catch all errors +set -eo pipefail + +# Uncomment for debugging +# set -x +# env + +git config --global --add safe.directory "*" + +# VENV=./ +# python -m venv $VENV +# if [ -f $VENV/Scripts/activate ]; then +# . $VENV/Scripts/activate +# else +# . $VENV/bin/activate +# fi +python -m pip install -U pip setuptools + +# .devcontainer/update-content-command.sh diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh new file mode 100755 index 0000000..eadb501 --- /dev/null +++ b/.devcontainer/post-create-command.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Immediately catch all errors +set -eo pipefail + +# Uncomment for debugging +# set -x +# env + +# Enable autocomplete for user +cp /etc/skel/.bashrc ~/ + +python -m pytest --cov --cov-branch --cov-report xml:coverage.xml --cov-config setup.cfg diff --git a/.devcontainer/update-content-command.sh b/.devcontainer/update-content-command.sh new file mode 100755 index 0000000..8def233 --- /dev/null +++ b/.devcontainer/update-content-command.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Immediately catch all errors +set -eo pipefail + +# Uncomment for debugging +# set -x +# env + +# Download constraints +curl -sSLo constraints.txt https://raw.githubusercontent.com/colcon/ci/main/constraints.txt +# Remove this package from constraints +sed -i "/^$(python setup.py --name)@/d" constraints.txt +# Install dependencies, including any 'test' extras, as well as pytest-cov +python -m pip install -U -e .[test] pytest-cov -c constraints.txt From 71b530e9a6ab93129c0589a8d7e34ea0c0f8f565 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 3 Nov 2023 22:38:55 -0400 Subject: [PATCH 2/8] Simplify config --- .devcontainer/devcontainer.json | 14 ++------------ .devcontainer/on-create-command.sh | 17 ++++++++--------- .devcontainer/post-create-command.sh | 6 +++++- .devcontainer/update-content-command.sh | 15 --------------- 4 files changed, 15 insertions(+), 37 deletions(-) delete mode 100755 .devcontainer/update-content-command.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7f21241..00564e2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,24 +1,14 @@ { "name": "colcon-clean", - "build": { - "dockerfile": "../Dockerfile", - "context": "..", - "target": "builder" - }, - "workspaceFolder": "/usr/src/app", + "image": "python:3", + "workspaceFolder": "/workspace/colcon-clean", "workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind", "onCreateCommand": ".devcontainer/on-create-command.sh", - "updateContentCommand": ".devcontainer/update-content-command.sh", "postCreateCommand": ".devcontainer/post-create-command.sh", "customizations": { "vscode": { "settings": {}, "extensions": [ - "eamodio.gitlens", - "esbenp.prettier-vscode", - "GitHub.copilot", - "streetsidesoftware.code-spell-checker", - "dirk-thomas.vscode-empy", "ms-python.python" ] } diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh index 154a3b2..aec466e 100755 --- a/.devcontainer/on-create-command.sh +++ b/.devcontainer/on-create-command.sh @@ -9,13 +9,12 @@ set -eo pipefail git config --global --add safe.directory "*" -# VENV=./ -# python -m venv $VENV -# if [ -f $VENV/Scripts/activate ]; then -# . $VENV/Scripts/activate -# else -# . $VENV/bin/activate -# fi -python -m pip install -U pip setuptools +CONSTRAINTS_URL=https://raw.githubusercontent.com/colcon/ci/main/constraints.txt +CONSTRAINTS_FILE=/tmp/constraints.txt -# .devcontainer/update-content-command.sh +# 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 diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index eadb501..7fa8dbc 100755 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -10,4 +10,8 @@ set -eo pipefail # Enable autocomplete for user cp /etc/skel/.bashrc ~/ -python -m pytest --cov --cov-branch --cov-report xml:coverage.xml --cov-config setup.cfg +# pytest \ +# --cov \ +# --cov-branch \ +# --cov-report xml:../coverage.xml \ +# --cov-config setup.cfg diff --git a/.devcontainer/update-content-command.sh b/.devcontainer/update-content-command.sh deleted file mode 100755 index 8def233..0000000 --- a/.devcontainer/update-content-command.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# Immediately catch all errors -set -eo pipefail - -# Uncomment for debugging -# set -x -# env - -# Download constraints -curl -sSLo constraints.txt https://raw.githubusercontent.com/colcon/ci/main/constraints.txt -# Remove this package from constraints -sed -i "/^$(python setup.py --name)@/d" constraints.txt -# Install dependencies, including any 'test' extras, as well as pytest-cov -python -m pip install -U -e .[test] pytest-cov -c constraints.txt From fc88efd1b17d991ab7164a3fde1da63b5d40565d Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 3 Nov 2023 23:04:19 -0400 Subject: [PATCH 3/8] Use default python interpreter --- .vscode/settings.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 1675169..3204818 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,6 @@ "python.linting.pycodestyleEnabled": true, "cSpell.words": [ "noqa" - ] + ], + "python.languageServer": "Default" } \ No newline at end of file From e2f571a5ded7b7252babbff5674bf24fb2d2b99e Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 3 Nov 2023 23:10:49 -0400 Subject: [PATCH 4/8] Remove old dev files --- .dockerignore | 6 ------ Dockerfile | 16 ---------------- 2 files changed, 22 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile 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/Dockerfile b/Dockerfile deleted file mode 100644 index 0aa7e01..0000000 --- a/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM python:3 - -WORKDIR /usr/src/app - -COPY setup.cfg setup.py ./ -COPY colcon_clean/__init__.py ./colcon_clean/__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 From ac3319d0cc39b0c915fa5d9997d1f38a1611a21d Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sat, 4 Nov 2023 03:13:59 +0000 Subject: [PATCH 5/8] Simpify config --- .devcontainer/on-create-command.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh index aec466e..56fa1dd 100755 --- a/.devcontainer/on-create-command.sh +++ b/.devcontainer/on-create-command.sh @@ -7,8 +7,6 @@ set -eo pipefail # 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 From bbed3693d4728722cfd49a52b13e600ff6e248cb Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sat, 4 Nov 2023 03:29:56 +0000 Subject: [PATCH 6/8] Configure vscode to run pytest --- .devcontainer/post-create-command.sh | 6 ------ .vscode/settings.json | 12 +++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index 7fa8dbc..486724e 100755 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -9,9 +9,3 @@ set -eo pipefail # Enable autocomplete for user cp /etc/skel/.bashrc ~/ - -# pytest \ -# --cov \ -# --cov-branch \ -# --cov-report xml:../coverage.xml \ -# --cov-config setup.cfg diff --git a/.vscode/settings.json b/.vscode/settings.json index 3204818..b52acff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,15 @@ "cSpell.words": [ "noqa" ], - "python.languageServer": "Default" + "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 } \ No newline at end of file From 54683d77887f16201d55676a5d32a176302d07cf Mon Sep 17 00:00:00 2001 From: ruffsl Date: Sat, 4 Nov 2023 03:32:43 +0000 Subject: [PATCH 7/8] Formatting --- .devcontainer/devcontainer.json | 6 +++--- .vscode/settings.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 00564e2..9f09003 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,8 +9,8 @@ "vscode": { "settings": {}, "extensions": [ - "ms-python.python" - ] + "ms-python.python" + ] } } -} \ No newline at end of file +} diff --git a/.vscode/settings.json b/.vscode/settings.json index b52acff..c051b7a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,4 +17,4 @@ ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true -} \ No newline at end of file +} From e6eb357e09f9597ad8e3d3c0a601e408e888dee0 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 3 Nov 2023 23:50:52 -0400 Subject: [PATCH 8/8] Revert "Simpify config" This reverts commit ac3319d0cc39b0c915fa5d9997d1f38a1611a21d. --- .devcontainer/on-create-command.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.devcontainer/on-create-command.sh b/.devcontainer/on-create-command.sh index 56fa1dd..aec466e 100755 --- a/.devcontainer/on-create-command.sh +++ b/.devcontainer/on-create-command.sh @@ -7,6 +7,8 @@ set -eo pipefail # 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