From ea905323a54029d4205cd4255338d5a7d490a51e Mon Sep 17 00:00:00 2001 From: Henry Huang <69825683+hhenry01@users.noreply.github.com> Date: Sat, 2 Sep 2023 13:06:34 -0700 Subject: [PATCH 01/20] Add C++ unit testing (#58) * Add ROS Node attach and CPP unit test extension * rebase to latest devcontainer --- .devcontainer/config/sailbot_workspace.code-workspace | 11 +++++++++++ .devcontainer/devcontainer.json | 1 + 2 files changed, 12 insertions(+) diff --git a/.devcontainer/config/sailbot_workspace.code-workspace b/.devcontainer/config/sailbot_workspace.code-workspace index 78d735fde..a2645ab36 100644 --- a/.devcontainer/config/sailbot_workspace.code-workspace +++ b/.devcontainer/config/sailbot_workspace.code-workspace @@ -173,6 +173,17 @@ "editor.rulers": [120], }, + "testMate.cpp.discovery.loadOnStartup": true, + // The following setting just changes the default prelaunch task from "build" to "debug" + "testMate.cpp.test.advancedExecutables": [ + { + "pattern": "{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*", + "runTask": { + "before": [ "debug" ] + } + } + ], + // markdown // copied from docs: https://github.com/UBCSailbot/docs/blob/main/.vscode/settings.json "[markdown]": { diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f7e984053..b446a3eef 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -60,6 +60,7 @@ "jeff-hykin.better-cpp-syntax", "KevinRose.vsc-python-indent", "llvm-vs-code-extensions.vscode-clangd", + "matepek.vscode-catch2-test-adapter", "mongodb.mongodb-vscode", "ms-iot.vscode-ros", "ms-python.black-formatter", From a45503a6c211ffdc6dc57dd0bee04a5a4425f4bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 08:19:23 -0700 Subject: [PATCH 02/20] Bump actions/checkout from 3 to 4 (#160) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/test_definitions.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_definitions.yml b/.github/workflows/test_definitions.yml index ce56d1a68..55a1e0844 100644 --- a/.github/workflows/test_definitions.yml +++ b/.github/workflows/test_definitions.yml @@ -43,20 +43,20 @@ jobs: if: ${{ inputs.ros-ci }} steps: - name: Checkout workspace - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/sailbot_workspace - name: Checkout ROS package if: ${{ inputs.repository != 'sailbot_workspace' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/${{ inputs.repository }} path: src/${{ inputs.repository }} - name: Checkout custom_interfaces ROS package if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/custom_interfaces path: src/custom_interfaces @@ -77,20 +77,20 @@ jobs: if: ${{ inputs.ros-ci }} steps: - name: Checkout workspace - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/sailbot_workspace - name: Checkout ROS package if: ${{ inputs.repository != 'sailbot_workspace' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/${{ inputs.repository }} path: src/${{ inputs.repository }} - name: Checkout custom_interfaces ROS package if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/custom_interfaces path: src/custom_interfaces @@ -106,20 +106,20 @@ jobs: if: inputs.clang-tidy steps: - name: Checkout workspace - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/sailbot_workspace - name: Checkout ROS package if: ${{ inputs.repository != 'sailbot_workspace' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/${{ inputs.repository }} path: src/${{ inputs.repository }} - name: Checkout custom_interfaces ROS package if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/custom_interfaces path: src/custom_interfaces @@ -135,7 +135,7 @@ jobs: if: ${{ inputs.markdown-ci }} steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/${{ inputs.repository }} @@ -152,7 +152,7 @@ jobs: if: ${{ inputs.markdown-ci }} steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: UBCSailbot/sailbot_workspace From a5b55dddc49db41d34d3cf95ed8bbea69d4a7822 Mon Sep 17 00:00:00 2001 From: Henry Huang <69825683+hhenry01@users.noreply.github.com> Date: Thu, 7 Sep 2023 09:55:38 -0700 Subject: [PATCH 03/20] mongodb C++ Support (#161) * Add mongodb c++ dependencies * Update Dockerfile --- .devcontainer/Dockerfile | 2 +- .devcontainer/base-dev/base-dev.Dockerfile | 12 ++++++++++++ .../config/sailbot_workspace.code-workspace | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 235f9e336..d85a7bcec 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:fix-mongodb-tools +FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:mongodb-cpp # Copy configuration files (e.g., .vimrc) from config/ to the container's home directory ARG USERNAME=ros diff --git a/.devcontainer/base-dev/base-dev.Dockerfile b/.devcontainer/base-dev/base-dev.Dockerfile index 4c1c127c7..5119c1bf2 100644 --- a/.devcontainer/base-dev/base-dev.Dockerfile +++ b/.devcontainer/base-dev/base-dev.Dockerfile @@ -70,11 +70,23 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ mongodb-database-tools \ mongodb-mongosh \ + libmongoc-dev \ && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* ENV DEBIAN_FRONTEND= +# setup MongoDB C++ Packages +ENV DEBIAN_FRONTEND=noninteractive +# mongo-cxx-driver version must match libmongoc-dev version - see https://mongocxx.org/mongocxx-v3/installation/linux/ +RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz \ + && tar -xzf mongo-cxx-driver-r3.6.7.tar.gz \ + && cd mongo-cxx-driver-r3.6.7/build \ + && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ + && cmake --build . \ + && cmake --build . --target install +ENV DEBIAN_FRONTEND= + FROM local-base as ros-dev # From https://github.com/athackst/dockerfiles/blob/32a872348af0ad25ec4a6e6184cb803357acb6ab/ros2/humble.Dockerfile diff --git a/.devcontainer/config/sailbot_workspace.code-workspace b/.devcontainer/config/sailbot_workspace.code-workspace index a2645ab36..c08880b1b 100644 --- a/.devcontainer/config/sailbot_workspace.code-workspace +++ b/.devcontainer/config/sailbot_workspace.code-workspace @@ -41,6 +41,7 @@ "cSpell.words": [ "athackst", "autopep", + "bsoncxx", "buildx", "cmake", "cppcheck", @@ -54,6 +55,7 @@ "isort", "kmph", "mkdocs", + "mongocxx", "noqa", "OMPL", "pallete", From 5e0fd567bce0906d07c5138c2e330fdc1fe5d31d Mon Sep 17 00:00:00 2001 From: Henry Huang <69825683+hhenry01@users.noreply.github.com> Date: Sun, 10 Sep 2023 16:54:54 -0700 Subject: [PATCH 04/20] Fix C++ debug config (#162) --- .devcontainer/config/sailbot_workspace.code-workspace | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/config/sailbot_workspace.code-workspace b/.devcontainer/config/sailbot_workspace.code-workspace index c08880b1b..954e8fe15 100644 --- a/.devcontainer/config/sailbot_workspace.code-workspace +++ b/.devcontainer/config/sailbot_workspace.code-workspace @@ -238,7 +238,8 @@ "request": "launch", "program": "${workspaceFolder:sailbot_workspace}/install/lib/${input:node}", "args": [], - "preLaunchTask": "Build All", + // Have testMate extension build before starting debug session to avoid building twice + // "preLaunchTask": "debug", "stopAtEntry": false, "cwd": "${workspaceFolder:sailbot_workspace}", "externalConsole": false, From 6ff96ba6a35a83ac64808028c0c0d09c76e44ea7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:32:44 -0700 Subject: [PATCH 05/20] Bump docker/setup-buildx-action from 2 to 3 (#163) Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](https://github.com/docker/setup-buildx-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 163020234..8c49f56ef 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -22,7 +22,7 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 with: platforms: linux/arm64,linux/amd64 From 19ea6f4bbda16ad5838bdd9db27685b6d1524d62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:33:00 -0700 Subject: [PATCH 06/20] Bump docker/build-push-action from 4 to 5 (#164) Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v4...v5) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build-images.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 8c49f56ef..f35ee05a7 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -34,7 +34,7 @@ jobs: password: ${{ secrets.PAT_TOKEN }} - name: Build and push base - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: "{{defaultContext}}:.devcontainer/base-dev" file: base-dev.Dockerfile @@ -46,7 +46,7 @@ jobs: target: base - name: Build and push local-base - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: "{{defaultContext}}:.devcontainer/base-dev" file: base-dev.Dockerfile @@ -58,7 +58,7 @@ jobs: target: local-base - name: Build and push dev - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: "{{defaultContext}}:.devcontainer/base-dev" file: base-dev.Dockerfile From d3fbd10e12491ace5b773bfc3232eb8bd00cb2a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:33:27 -0700 Subject: [PATCH 07/20] Bump docker/setup-qemu-action from 2 to 3 (#165) Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](https://github.com/docker/setup-qemu-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index f35ee05a7..7660f3715 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From c0c09f92ab33483c54a3604eb5ace8e94ac3432a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:33:45 -0700 Subject: [PATCH 08/20] Bump docker/login-action from 2 to 3 (#166) Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 7660f3715..15519bdd1 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -27,7 +27,7 @@ jobs: platforms: linux/arm64,linux/amd64 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} From bcd5466f51bbebc34029043ec13635607c324e19 Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Mon, 25 Sep 2023 11:04:26 -0700 Subject: [PATCH 09/20] Add notebooks repo (#157) * Add and configure Jupyter extension * Add notebooks repo --- .devcontainer/config/sailbot_workspace.code-workspace | 5 +++++ .devcontainer/devcontainer.json | 1 + src/new_project.repos | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/.devcontainer/config/sailbot_workspace.code-workspace b/.devcontainer/config/sailbot_workspace.code-workspace index 954e8fe15..6967e20c5 100644 --- a/.devcontainer/config/sailbot_workspace.code-workspace +++ b/.devcontainer/config/sailbot_workspace.code-workspace @@ -18,6 +18,9 @@ { "path": "../../src/network_systems" }, + { + "path": "../../src/notebooks" + }, { "path": "../../src/raye-local-pathfinding" }, @@ -125,6 +128,8 @@ "editor.formatOnSave": true, "editor.rulers": [99], }, + "notebook.formatOnCellExecution": true, + "notebook.formatOnSave.enabled": true, "python.analysis.diagnosticMode": "workspace", "python.analysis.extraPaths": [ "/workspaces/sailbot_workspace/install/lib/python3.10/site-packages", diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b446a3eef..8c6feb167 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -66,6 +66,7 @@ "ms-python.black-formatter", "ms-python.isort", "ms-python.vscode-pylance", + "ms-toolsai.jupyter", "ms-vsliveshare.vsliveshare", "njpwerner.autodocstring", "streetsidesoftware.code-spell-checker", diff --git a/src/new_project.repos b/src/new_project.repos index f0c32dbaa..b9083c076 100644 --- a/src/new_project.repos +++ b/src/new_project.repos @@ -42,6 +42,11 @@ repositories: url: https://github.com/UBCSailbot/network_systems version: main + notebooks: + type: git + url: https://github.com/UBCSailbot/notebooks + version: main + raye-local-pathfinding: type: git url: https://github.com/UBCSailbot/raye-local-pathfinding From ab968887cb6a6a8efbca8f403d88ffa448bc0a3f Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Mon, 25 Sep 2023 11:23:07 -0700 Subject: [PATCH 10/20] Revert "Revert setup skipping existing repositories" (#168) * Revert "Revert setup skipping existing repositories (#151)" This reverts commit 06eedc6ed78f2cfdb4d328e240361d49214d02c1. * Rename new_project.repos to polaris.repos --- .devcontainer/config/sailbot_workspace.code-workspace | 4 ++-- .github/actions/ament-lint/run.sh | 2 +- .gitignore | 2 +- setup.sh | 2 +- src/{new_project.repos => polaris.repos} | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename src/{new_project.repos => polaris.repos} (100%) diff --git a/.devcontainer/config/sailbot_workspace.code-workspace b/.devcontainer/config/sailbot_workspace.code-workspace index 6967e20c5..fbc998700 100644 --- a/.devcontainer/config/sailbot_workspace.code-workspace +++ b/.devcontainer/config/sailbot_workspace.code-workspace @@ -417,9 +417,9 @@ // Workspace editing tasks { "label": "clone source repositories", - "detail": "Clone the repositories specified in src/new_project.repos to src/", + "detail": "Clone the repositories specified in src/polaris.repos to src/", "type": "shell", - "command": "vcs import < src/new_project.repos src --skip-existing", + "command": "vcs import < src/polaris.repos src --skip-existing", "problemMatcher": [] }, { diff --git a/.github/actions/ament-lint/run.sh b/.github/actions/ament-lint/run.sh index 1959f196b..813997678 100755 --- a/.github/actions/ament-lint/run.sh +++ b/.github/actions/ament-lint/run.sh @@ -47,5 +47,5 @@ source /opt/ros/${ROS_DISTRO}/setup.bash cd src # Exclude repos and files we don't want to lint -VALID_SRC_DIRS=$(ls | grep -v -e virtual_iridium -e docs -e raye-local-pathfinding -e new_project.repos) +VALID_SRC_DIRS=$(ls | grep -v -e virtual_iridium -e docs -e raye-local-pathfinding -e polaris.repos) lint ${VALID_SRC_DIRS} diff --git a/.gitignore b/.gitignore index 7af5573e6..31103c815 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ site/* # vcstool packages src/* !src/global_launch -!src/new_project.repos +!src/polaris.repos # configuration files .devcontainer/config/* diff --git a/setup.sh b/setup.sh index 192222e0a..2810ac16e 100755 --- a/setup.sh +++ b/setup.sh @@ -10,7 +10,7 @@ function warn() { # Import all project repositories if [[ $DISABLE_VCS != "true" ]]; then echo "Importing project repositories..." - vcs import < src/new_project.repos src + vcs import < src/polaris.repos src --skip-existing else warn "VCS disabled. Skipping project repository imports..." fi diff --git a/src/new_project.repos b/src/polaris.repos similarity index 100% rename from src/new_project.repos rename to src/polaris.repos From f3c28df88fd01ca9fa09e3f847b25765b2b994be Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Mon, 25 Sep 2023 14:06:45 -0700 Subject: [PATCH 11/20] Add controller repository (#169) --- .devcontainer/config/sailbot_workspace.code-workspace | 3 +++ src/polaris.repos | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/.devcontainer/config/sailbot_workspace.code-workspace b/.devcontainer/config/sailbot_workspace.code-workspace index fbc998700..2ff328e96 100644 --- a/.devcontainer/config/sailbot_workspace.code-workspace +++ b/.devcontainer/config/sailbot_workspace.code-workspace @@ -6,6 +6,9 @@ { "path": "../../src/boat_simulator" }, + { + "path": "../../src/controller" + }, { "path": "../../src/custom_interfaces" }, diff --git a/src/polaris.repos b/src/polaris.repos index b9083c076..7ba1a9f74 100644 --- a/src/polaris.repos +++ b/src/polaris.repos @@ -22,6 +22,11 @@ repositories: url: https://github.com/UBCSailbot/boat_simulator version: main + controller: + type: git + url: https://github.com/UBCSailbot/controller + version: main + custom_interfaces: type: git url: https://github.com/UBCSailbot/custom_interfaces From f0e879cbd3b552b3eb6799bc4139c3b3fc331f69 Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Mon, 2 Oct 2023 20:32:04 -0700 Subject: [PATCH 12/20] Fix base/dev image long build times (#173) * Move cpp mongodb driver installation to pre-base * Fix git clone error * Fix curl error * Refactor certificate fix * Refactor mongodb-cpp-driver installation * Use mongo-cxx-driver-builder in pre-base * Install mongoc-dev package * Revert * Add git as pre-base dep * Build mongo-cxx-driver in separate layer * Change order * Update tag name * Try original first * Narrow scope * Update tags to v2 image --- .devcontainer/Dockerfile | 2 +- .devcontainer/base-dev/base-dev.Dockerfile | 14 +------ .devcontainer/pre-base/build-pre-base.sh | 2 +- .devcontainer/pre-base/pre-base.Dockerfile | 43 ++++++++++++++++++++-- 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d85a7bcec..7fc073865 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:mongodb-cpp +FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:refactor-images-v2 # Copy configuration files (e.g., .vimrc) from config/ to the container's home directory ARG USERNAME=ros diff --git a/.devcontainer/base-dev/base-dev.Dockerfile b/.devcontainer/base-dev/base-dev.Dockerfile index 5119c1bf2..ce7ebcee5 100644 --- a/.devcontainer/base-dev/base-dev.Dockerfile +++ b/.devcontainer/base-dev/base-dev.Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/ubcsailbot/sailbot_workspace/pre-base:ros_humble-ompl_4c86b2f as base +FROM ghcr.io/ubcsailbot/sailbot_workspace/pre-base:ros_humble-ompl_4c86b2f-mongo_367-v2 as base # install base apt dependencies ENV DEBIAN_FRONTEND=noninteractive @@ -70,23 +70,11 @@ RUN apt-get update \ && apt-get install -y --no-install-recommends \ mongodb-database-tools \ mongodb-mongosh \ - libmongoc-dev \ && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* ENV DEBIAN_FRONTEND= -# setup MongoDB C++ Packages -ENV DEBIAN_FRONTEND=noninteractive -# mongo-cxx-driver version must match libmongoc-dev version - see https://mongocxx.org/mongocxx-v3/installation/linux/ -RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz \ - && tar -xzf mongo-cxx-driver-r3.6.7.tar.gz \ - && cd mongo-cxx-driver-r3.6.7/build \ - && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ - && cmake --build . \ - && cmake --build . --target install -ENV DEBIAN_FRONTEND= - FROM local-base as ros-dev # From https://github.com/athackst/dockerfiles/blob/32a872348af0ad25ec4a6e6184cb803357acb6ab/ros2/humble.Dockerfile diff --git a/.devcontainer/pre-base/build-pre-base.sh b/.devcontainer/pre-base/build-pre-base.sh index 121e458f9..7cdba38e5 100755 --- a/.devcontainer/pre-base/build-pre-base.sh +++ b/.devcontainer/pre-base/build-pre-base.sh @@ -2,6 +2,6 @@ docker buildx build . \ --file pre-base.Dockerfile \ - --tag ghcr.io/ubcsailbot/sailbot_workspace/pre-base:ros_humble-ompl_4c86b2f \ + --tag ghcr.io/ubcsailbot/sailbot_workspace/pre-base:ros_humble-ompl_4c86b2f-mongo_367-v2 \ --platform linux/arm64,linux/amd64 \ --push diff --git a/.devcontainer/pre-base/pre-base.Dockerfile b/.devcontainer/pre-base/pre-base.Dockerfile index b73beb1a1..66c342830 100644 --- a/.devcontainer/pre-base/pre-base.Dockerfile +++ b/.devcontainer/pre-base/pre-base.Dockerfile @@ -1,4 +1,15 @@ -FROM ubuntu:22.04 AS ompl-source +FROM ubuntu:22.04 AS fix-certificates + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + ca-certificates \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* +ENV DEBIAN_FRONTEND= + +FROM fix-certificates AS ompl-source ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update \ @@ -11,7 +22,7 @@ WORKDIR /ompl RUN git reset --hard 4c86b2f # From https://github.com/athackst/dockerfiles/blob/32a872348af0ad25ec4a6e6184cb803357acb6ab/ros2/humble.Dockerfile -FROM ubuntu:22.04 AS ros-pre-base +FROM fix-certificates AS ros-pre-base ENV DEBIAN_FRONTEND=noninteractive @@ -55,7 +66,7 @@ ENV ROS_VERSION=2 ENV DEBIAN_FRONTEND= # Based on https://github.com/ompl/ompl/blob/4c86b2fecf7084ae9073bf6a837176d0be169721/scripts/docker/ompl.Dockerfile -FROM ros-pre-base AS ompl-builder +FROM fix-certificates AS ompl-builder # avoid interactive configuration dialog from tzdata, which gets pulled in # as a dependency ENV DEBIAN_FRONTEND=noninteractive @@ -99,6 +110,30 @@ RUN cmake \ && ninja -j `nproc` \ && ninja install +FROM fix-certificates AS mongo-cxx-driver-builder + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + git \ + libmongoc-dev \ + wget \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* + +# setup MongoDB C++ Packages +# mongo-cxx-driver version must match libmongoc-dev version - see https://mongocxx.org/mongocxx-v3/installation/linux/ +RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz \ + && tar -xzf mongo-cxx-driver-r3.6.7.tar.gz \ + && cd mongo-cxx-driver-r3.6.7/build \ + && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ + && cmake --build . \ + && cmake --build . --target install +ENV DEBIAN_FRONTEND= + FROM ros-pre-base as pre-base LABEL org.opencontainers.image.source = "https://github.com/UBCSailbot/sailbot_workspace" @@ -115,6 +150,7 @@ RUN apt-get update \ libboost-system-dev \ libeigen3-dev \ libflann-dev \ + libmongoc-dev \ libode-dev \ libtriangle-dev \ ninja-build \ @@ -129,3 +165,4 @@ RUN apt-get update \ ENV DEBIAN_FRONTEND= COPY --from=ompl-builder /usr /usr +COPY --from=mongo-cxx-driver-builder /usr/local /usr/local From 8d0ae2e9975fefbf2a02875747de764df862905a Mon Sep 17 00:00:00 2001 From: Henry Huang <69825683+hhenry01@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:33:32 -0700 Subject: [PATCH 13/20] Restore BUILD_TYPE Flag (#172) --- build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sh b/build.sh index c6165525c..ab28ca2f8 100755 --- a/build.sh +++ b/build.sh @@ -41,6 +41,9 @@ else STATIC_ANALYSIS="ON" UNIT_TEST="ON" fi +if [[ $UNIT_TEST = "ON" ]]; then + BUILD_TYPE="Debug" +fi # Build ROS packages in src directory colcon build \ From d51e8f11380c18d9c1b88bcffc8740949c6a1693 Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Mon, 2 Oct 2023 21:00:20 -0700 Subject: [PATCH 14/20] Add local pathfinding python dependencies (#171) * Add local pathfinding python dependencies * Update dev container base image --- .devcontainer/Dockerfile | 2 +- .devcontainer/base-dev/base-dev.Dockerfile | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7fc073865..919452d0c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:refactor-images-v2 +FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:add-py-deps-v2 # Copy configuration files (e.g., .vimrc) from config/ to the container's home directory ARG USERNAME=ros diff --git a/.devcontainer/base-dev/base-dev.Dockerfile b/.devcontainer/base-dev/base-dev.Dockerfile index ce7ebcee5..ed8a5ecab 100644 --- a/.devcontainer/base-dev/base-dev.Dockerfile +++ b/.devcontainer/base-dev/base-dev.Dockerfile @@ -22,6 +22,11 @@ RUN apt-get update \ && rosdep init || echo "rosdep already initialized" ENV DEBIAN_FRONTEND= +# install base pip dependencies +RUN pip3 install \ + pyproj \ + shapely + # root bash configuration ENV ROS_WORKSPACE=/workspaces/sailbot_workspace COPY update-bashrc.sh /sbin/update-bashrc From cb6f026dae0a0632890dc03ddd0e934515a69f63 Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Tue, 3 Oct 2023 01:04:01 -0700 Subject: [PATCH 15/20] Refactor CI (#174) * Try moving checking out repos to action * Move back checkout workspace step * Test checking out custom_interfaces * Use new action in other jobs * Convert test action to composite * Debugging * Figured out directories * Run tests in one command * allocate a pseudo-TTY * Move website to separate dockerfile * Remove user * Update other actions to use docker-compose * temporarily hardcode branch * Try passing through environment variables * Set env variables * Set inputs * Fix file name * Update actions accordingly * Add mongodb environment variable * Undo branch hardcoding --- .devcontainer/docker-compose.yml | 2 + .github/actions/ament-lint/action.yml | 25 ++++++++-- .github/actions/checkout/action.yml | 24 ++++++++++ .github/actions/clang-tidy/action.yml | 22 +++++++-- .github/actions/docker-compose.ci.db.yml | 18 ++++++++ .github/actions/docker-compose.ci.yml | 23 +++++++++ .github/actions/test/action.yml | 22 +++++++-- .github/workflows/test_definitions.yml | 59 +++++++----------------- 8 files changed, 143 insertions(+), 52 deletions(-) create mode 100644 .github/actions/checkout/action.yml create mode 100644 .github/actions/docker-compose.ci.db.yml create mode 100644 .github/actions/docker-compose.ci.yml diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index da1dc0148..db0c247f2 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -7,6 +7,8 @@ services: build: context: . dockerfile: Dockerfile + environment: + - MONGODB_CONN_STR=mongodb://localhost:27017 volumes: - ..:/workspaces/sailbot_workspace:cached - sailbot-new-project-bashhistory:/home/ros/commandhistory:delegated diff --git a/.github/actions/ament-lint/action.yml b/.github/actions/ament-lint/action.yml index f5fcfb578..3825102d0 100644 --- a/.github/actions/ament-lint/action.yml +++ b/.github/actions/ament-lint/action.yml @@ -1,6 +1,25 @@ name: 'Ament Lint' description: 'Ament Lint using devcontainer' + +inputs: + linter: + description: 'The linter to run' + required: true + disable_vcs: + description: 'Whether to disable VCS cloning all repositories' + required: true + runs: - using: 'docker' - image: '../../../.devcontainer/Dockerfile' - entrypoint: ".github/actions/ament-lint/run.sh" + using: "composite" + steps: + - name: Build Containers + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml build + + - name: Run Containers + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml up -d + + - name: Run Tests + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml exec -T sailbot-workspace /bin/bash -c "export LINTER=${{ inputs.linter}} && export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/ament-lint/run.sh" diff --git a/.github/actions/checkout/action.yml b/.github/actions/checkout/action.yml new file mode 100644 index 000000000..c616eeeb1 --- /dev/null +++ b/.github/actions/checkout/action.yml @@ -0,0 +1,24 @@ +name: 'Checkout Repositories' +description: 'Checkout the repositories depending on the inputs' + +inputs: + repository: + description: 'The repository name: github.event.repository.name' + required: true + +runs: + using: "composite" + steps: + - name: Checkout ROS package + if: ${{ inputs.repository != 'sailbot_workspace' }} + uses: actions/checkout@v4 + with: + repository: UBCSailbot/${{ inputs.repository }} + path: src/${{ inputs.repository }} + + - name: Checkout custom_interfaces ROS package + if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }} + uses: actions/checkout@v4 + with: + repository: UBCSailbot/custom_interfaces + path: src/custom_interfaces diff --git a/.github/actions/clang-tidy/action.yml b/.github/actions/clang-tidy/action.yml index e398c2b4d..34f261442 100644 --- a/.github/actions/clang-tidy/action.yml +++ b/.github/actions/clang-tidy/action.yml @@ -1,6 +1,22 @@ name: 'Clang-Tidy' description: 'Clang-Tidy using devcontainer' + +inputs: + disable_vcs: + description: 'Whether to disable VCS cloning all repositories' + required: true + runs: - using: 'docker' - image: '../../../.devcontainer/Dockerfile' - entrypoint: ".github/actions/clang-tidy/run.sh" + using: "composite" + steps: + - name: Build Containers + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml build + + - name: Run Containers + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml up -d + + - name: Run Tests + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml exec -T sailbot-workspace /bin/bash -c "export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/clang-tidy/run.sh" diff --git a/.github/actions/docker-compose.ci.db.yml b/.github/actions/docker-compose.ci.db.yml new file mode 100644 index 000000000..db408f698 --- /dev/null +++ b/.github/actions/docker-compose.ci.db.yml @@ -0,0 +1,18 @@ +# adapted from https://github.com/microsoft/vscode-dev-containers/blob/main/containers/javascript-node-mongo/.devcontainer/docker-compose.yml +# Note: the "ports" property in this file will not forward from a codespace; add to "forwardPorts" in devcontainer.json instead +version: '3.8' + +services: + # URL: mongodb://localhost:27017 + mongodb: + image: mongo:latest + restart: unless-stopped + + # Runs on the same network as the workspace container, allows "forwardPorts" in devcontainer.json function. + network_mode: service:sailbot-workspace + + # Uncomment to change startup options + # environment: + # MONGO_INITDB_ROOT_USERNAME: root + # MONGO_INITDB_ROOT_PASSWORD: example + # MONGO_INITDB_DATABASE: your-database-here diff --git a/.github/actions/docker-compose.ci.yml b/.github/actions/docker-compose.ci.yml new file mode 100644 index 000000000..6e713a703 --- /dev/null +++ b/.github/actions/docker-compose.ci.yml @@ -0,0 +1,23 @@ +# adapted from https://github.com/microsoft/vscode-dev-containers/blob/main/containers/javascript-node-mongo/.devcontainer/docker-compose.yml +# Note: the "ports" property in this file will not forward from a codespace; add to "forwardPorts" in devcontainer.json instead +version: '3.8' + +services: + sailbot-workspace: + build: + context: ../../.devcontainer + dockerfile: Dockerfile + environment: + - MONGODB_CONN_STR=mongodb://localhost:27017 + volumes: + - ../..:/workspaces/sailbot_workspace:cached + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + + # From run arguments of template repository + cap_add: + - SYS_PTRACE + security_opt: + - seccomp:unconfined + - apparmor:unconfined diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 4e4cf0011..2b34ae858 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -1,6 +1,22 @@ name: 'Test' description: 'Test using devcontainer' + +inputs: + disable_vcs: + description: 'Whether to disable VCS cloning all repositories' + required: true + runs: - using: 'docker' - image: '../../../.devcontainer/Dockerfile' - entrypoint: ".github/actions/test/run.sh" + using: "composite" + steps: + - name: Build Containers + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml -f .github/actions/docker-compose.ci.db.yml build + + - name: Run Containers + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml -f .github/actions/docker-compose.ci.db.yml up -d + + - name: Run Tests + shell: bash + run: docker-compose -f .github/actions/docker-compose.ci.yml -f .github/actions/docker-compose.ci.db.yml exec -T sailbot-workspace /bin/bash -c "export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/test/run.sh" diff --git a/.github/workflows/test_definitions.yml b/.github/workflows/test_definitions.yml index 55a1e0844..cdd90de57 100644 --- a/.github/workflows/test_definitions.yml +++ b/.github/workflows/test_definitions.yml @@ -47,24 +47,15 @@ jobs: with: repository: UBCSailbot/sailbot_workspace - - name: Checkout ROS package - if: ${{ inputs.repository != 'sailbot_workspace' }} - uses: actions/checkout@v4 - with: - repository: UBCSailbot/${{ inputs.repository }} - path: src/${{ inputs.repository }} - - - name: Checkout custom_interfaces ROS package - if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }} - uses: actions/checkout@v4 + - name: Checkout repositories + uses: ./.github/actions/checkout/ with: - repository: UBCSailbot/custom_interfaces - path: src/custom_interfaces + repository: ${{ inputs.repository }} - name: Test uses: ./.github/actions/test/ - env: - DISABLE_VCS: ${{ inputs.repository != 'sailbot_workspace' }} + with: + disable_vcs: ${{ inputs.repository != 'sailbot_workspace' }} ament-lint: strategy: @@ -81,25 +72,16 @@ jobs: with: repository: UBCSailbot/sailbot_workspace - - name: Checkout ROS package - if: ${{ inputs.repository != 'sailbot_workspace' }} - uses: actions/checkout@v4 - with: - repository: UBCSailbot/${{ inputs.repository }} - path: src/${{ inputs.repository }} - - - name: Checkout custom_interfaces ROS package - if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }} - uses: actions/checkout@v4 + - name: Checkout repositories + uses: ./.github/actions/checkout/ with: - repository: UBCSailbot/custom_interfaces - path: src/custom_interfaces + repository: ${{ inputs.repository }} - name: Run linter uses: ./.github/actions/ament-lint/ - env: - LINTER: ${{ matrix.linter }} - DISABLE_VCS: ${{ inputs.repository != 'sailbot_workspace' }} + with: + linter: ${{ matrix.linter }} + disable_vcs: ${{ inputs.repository != 'sailbot_workspace' }} clang-tidy: runs-on: ubuntu-latest @@ -110,24 +92,15 @@ jobs: with: repository: UBCSailbot/sailbot_workspace - - name: Checkout ROS package - if: ${{ inputs.repository != 'sailbot_workspace' }} - uses: actions/checkout@v4 + - name: Checkout repositories + uses: ./.github/actions/checkout/ with: - repository: UBCSailbot/${{ inputs.repository }} - path: src/${{ inputs.repository }} - - - name: Checkout custom_interfaces ROS package - if: ${{ inputs.repository != 'sailbot_workspace' && inputs.repository != 'custom_interfaces' }} - uses: actions/checkout@v4 - with: - repository: UBCSailbot/custom_interfaces - path: src/custom_interfaces + repository: ${{ inputs.repository }} - name: Run linter uses: ./.github/actions/clang-tidy/ - env: - DISABLE_VCS: ${{ inputs.repository != 'sailbot_workspace' }} + with: + disable_vcs: ${{ inputs.repository != 'sailbot_workspace' }} # https://github.com/nosborn/github-action-markdown-cli markdownlint: From 3d9b365e6f60ee6f43cf1c13ea81bd5512ee5fb8 Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Tue, 3 Oct 2023 01:35:59 -0700 Subject: [PATCH 16/20] Simplify CI (#175) * Move CI docker-compose files to .devcontainer/ * Fix volume path * Use regular docker-compose files --- .github/actions/ament-lint/action.yml | 6 +++--- .github/actions/clang-tidy/action.yml | 6 +++--- .github/actions/docker-compose.ci.db.yml | 18 ------------------ .github/actions/docker-compose.ci.yml | 23 ----------------------- .github/actions/test/action.yml | 6 +++--- 5 files changed, 9 insertions(+), 50 deletions(-) delete mode 100644 .github/actions/docker-compose.ci.db.yml delete mode 100644 .github/actions/docker-compose.ci.yml diff --git a/.github/actions/ament-lint/action.yml b/.github/actions/ament-lint/action.yml index 3825102d0..e18805155 100644 --- a/.github/actions/ament-lint/action.yml +++ b/.github/actions/ament-lint/action.yml @@ -14,12 +14,12 @@ runs: steps: - name: Build Containers shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml build + run: docker-compose -f .devcontainer/docker-compose.yml build - name: Run Containers shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml up -d + run: docker-compose -f .devcontainer/docker-compose.yml up -d - name: Run Tests shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml exec -T sailbot-workspace /bin/bash -c "export LINTER=${{ inputs.linter}} && export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/ament-lint/run.sh" + run: docker-compose -f .devcontainer/docker-compose.yml exec -T sailbot-workspace /bin/bash -c "export LINTER=${{ inputs.linter}} && export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/ament-lint/run.sh" diff --git a/.github/actions/clang-tidy/action.yml b/.github/actions/clang-tidy/action.yml index 34f261442..d8b5a9039 100644 --- a/.github/actions/clang-tidy/action.yml +++ b/.github/actions/clang-tidy/action.yml @@ -11,12 +11,12 @@ runs: steps: - name: Build Containers shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml build + run: docker-compose -f .devcontainer/docker-compose.yml build - name: Run Containers shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml up -d + run: docker-compose -f .devcontainer/docker-compose.yml up -d - name: Run Tests shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml exec -T sailbot-workspace /bin/bash -c "export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/clang-tidy/run.sh" + run: docker-compose -f .devcontainer/docker-compose.yml exec -T sailbot-workspace /bin/bash -c "export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/clang-tidy/run.sh" diff --git a/.github/actions/docker-compose.ci.db.yml b/.github/actions/docker-compose.ci.db.yml deleted file mode 100644 index db408f698..000000000 --- a/.github/actions/docker-compose.ci.db.yml +++ /dev/null @@ -1,18 +0,0 @@ -# adapted from https://github.com/microsoft/vscode-dev-containers/blob/main/containers/javascript-node-mongo/.devcontainer/docker-compose.yml -# Note: the "ports" property in this file will not forward from a codespace; add to "forwardPorts" in devcontainer.json instead -version: '3.8' - -services: - # URL: mongodb://localhost:27017 - mongodb: - image: mongo:latest - restart: unless-stopped - - # Runs on the same network as the workspace container, allows "forwardPorts" in devcontainer.json function. - network_mode: service:sailbot-workspace - - # Uncomment to change startup options - # environment: - # MONGO_INITDB_ROOT_USERNAME: root - # MONGO_INITDB_ROOT_PASSWORD: example - # MONGO_INITDB_DATABASE: your-database-here diff --git a/.github/actions/docker-compose.ci.yml b/.github/actions/docker-compose.ci.yml deleted file mode 100644 index 6e713a703..000000000 --- a/.github/actions/docker-compose.ci.yml +++ /dev/null @@ -1,23 +0,0 @@ -# adapted from https://github.com/microsoft/vscode-dev-containers/blob/main/containers/javascript-node-mongo/.devcontainer/docker-compose.yml -# Note: the "ports" property in this file will not forward from a codespace; add to "forwardPorts" in devcontainer.json instead -version: '3.8' - -services: - sailbot-workspace: - build: - context: ../../.devcontainer - dockerfile: Dockerfile - environment: - - MONGODB_CONN_STR=mongodb://localhost:27017 - volumes: - - ../..:/workspaces/sailbot_workspace:cached - - # Overrides default command so things don't shut down after the process ends. - command: sleep infinity - - # From run arguments of template repository - cap_add: - - SYS_PTRACE - security_opt: - - seccomp:unconfined - - apparmor:unconfined diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 2b34ae858..46da4d182 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -11,12 +11,12 @@ runs: steps: - name: Build Containers shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml -f .github/actions/docker-compose.ci.db.yml build + run: docker-compose -f .devcontainer/docker-compose.yml -f .devcontainer/docker-compose.db.yml build - name: Run Containers shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml -f .github/actions/docker-compose.ci.db.yml up -d + run: docker-compose -f .devcontainer/docker-compose.yml -f .devcontainer/docker-compose.db.yml up -d - name: Run Tests shell: bash - run: docker-compose -f .github/actions/docker-compose.ci.yml -f .github/actions/docker-compose.ci.db.yml exec -T sailbot-workspace /bin/bash -c "export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/test/run.sh" + run: docker-compose -f .devcontainer/docker-compose.yml -f .devcontainer/docker-compose.db.yml exec -T sailbot-workspace /bin/bash -c "export DISABLE_VCS=${{ inputs.disable_vcs }} && cd /workspaces/sailbot_workspace && .github/actions/test/run.sh" From 23eff81439712c1b49a5c51179dfd8087810517a Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Tue, 3 Oct 2023 15:10:54 -0700 Subject: [PATCH 17/20] Request write access to repositories in codespace (#152) * Request write access to new project repositories in codespaces * Update repositories list --- .devcontainer/devcontainer.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8c6feb167..91259d1e5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,6 +22,20 @@ }, // Set *default* container specific settings.json values on container create. "customizations": { + "codespaces": { + "repositories": { + "UBCSailbot/boat_simulator": {"permissions": "write-all"}, + "UBCSailbot/controller": {"permissions": "write-all"}, + "UBCSailbot/custom_interfaces": {"permissions": "write-all"}, + "UBCSailbot/docs": {"permissions": "write-all"}, + "UBCSailbot/local_pathfinding": {"permissions": "write-all"}, + "UBCSailbot/network_systems": {"permissions": "write-all"}, + "UBCSailbot/notebooks": {"permissions": "write-all"}, + "UBCSailbot/raye-local-pathfinding": {"permissions": "write-all"}, + "UBCSailbot/website": {"permissions": "write-all"}, + "UBCSailbot/virtual_iridium": {"permissions": "write-all"} + } + }, "vscode": { "settings": { "terminal.integrated.profiles.linux": { From 2281e5a7ef28f849e93a543008d95848bb047a54 Mon Sep 17 00:00:00 2001 From: John Ahn Date: Wed, 4 Oct 2023 07:17:59 -0700 Subject: [PATCH 18/20] Website infrastructure updates (#170) --- .devcontainer/devcontainer.json | 1 + .devcontainer/website/website.Dockerfile | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 91259d1e5..1b76d3717 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -83,6 +83,7 @@ "ms-toolsai.jupyter", "ms-vsliveshare.vsliveshare", "njpwerner.autodocstring", + "stevejpurves.cucumber", "streetsidesoftware.code-spell-checker", "vscode-icons-team.vscode-icons", "zxh404.vscode-proto3" diff --git a/.devcontainer/website/website.Dockerfile b/.devcontainer/website/website.Dockerfile index d7b17b04f..893136ada 100644 --- a/.devcontainer/website/website.Dockerfile +++ b/.devcontainer/website/website.Dockerfile @@ -15,9 +15,6 @@ FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} # RUN su node -c "npm install -g " # Adapted from https://www.digitalocean.com/community/tutorials/how-to-build-a-node-js-application-with-docker -RUN mkdir -p /website/node_modules WORKDIR /website -COPY src/website/package*.json ./ -RUN npm install EXPOSE 3005 -CMD [ "npm", "run", "dev" ] +CMD npm install --legacy-peer-deps && npm run dev From 5ab530f07a6e054fca3024160be23b56824cfd98 Mon Sep 17 00:00:00 2001 From: Henry Huang <69825683+hhenry01@users.noreply.github.com> Date: Wed, 4 Oct 2023 10:59:48 -0700 Subject: [PATCH 19/20] Remove MONGODB_CONN_STR env var (#176) * Remove MONGODB_CONN_STR env var * Enable mongodb by default --- .devcontainer/devcontainer.json | 2 +- .devcontainer/docker-compose.yml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1b76d3717..1a5883f89 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ "name": "Sailbot Workspace", "dockerComposeFile": [ // Uncomment the files containing the programs you need - // "docker-compose.db.yml", // mongodb + "docker-compose.db.yml", // mongodb // "docker-compose.docs.yml", // docs // "docker-compose.website.yml", // grafana, website diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index db0c247f2..da1dc0148 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -7,8 +7,6 @@ services: build: context: . dockerfile: Dockerfile - environment: - - MONGODB_CONN_STR=mongodb://localhost:27017 volumes: - ..:/workspaces/sailbot_workspace:cached - sailbot-new-project-bashhistory:/home/ros/commandhistory:delegated From c2087b9bcb3d33b3d4337a3057c0b381d7a3e2ab Mon Sep 17 00:00:00 2001 From: Patrick Creighton Date: Mon, 9 Oct 2023 21:41:50 -0600 Subject: [PATCH 20/20] Python: add plotly pkg to base img (#177) * Python: add plotly pkg to base img * Update dev container accordingly --- .devcontainer/Dockerfile | 2 +- .devcontainer/base-dev/base-dev.Dockerfile | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 919452d0c..c9d3c01fb 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:add-py-deps-v2 +FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:py-plotly # Copy configuration files (e.g., .vimrc) from config/ to the container's home directory ARG USERNAME=ros diff --git a/.devcontainer/base-dev/base-dev.Dockerfile b/.devcontainer/base-dev/base-dev.Dockerfile index ed8a5ecab..08342ca59 100644 --- a/.devcontainer/base-dev/base-dev.Dockerfile +++ b/.devcontainer/base-dev/base-dev.Dockerfile @@ -24,6 +24,7 @@ ENV DEBIAN_FRONTEND= # install base pip dependencies RUN pip3 install \ + plotly \ pyproj \ shapely