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

Use Codespaces prebuilds #3470

Merged
merged 11 commits into from
Mar 13, 2023
Merged
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
8 changes: 7 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
{
"name": "Nav2",
"image": "ghcr.io/ros-planning/navigation2:main-dev",
"image": "ghcr.io/ros-planning/navigation2:main",
"runArgs": [
"--privileged",
"--network=host"
],
"workspaceMount": "source=${localWorkspaceFolder},target=/opt/overlay_ws/src/navigation2,type=bind",
"workspaceFolder": "/opt/overlay_ws/src",
"onCreateCommand": "navigation2/.devcontainer/on-create-command.sh",
"updateContentCommand": "navigation2/.devcontainer/update-content-command.sh",
"remoteEnv": {
"OVERLAY_MIXINS": "release ccache lld",
"CCACHE_DIR": "${containerEnv:OVERLAY_WS}/.ccache"
},
"features": {
// "ghcr.io/devcontainers/features/desktop-lite:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
Expand Down
19 changes: 19 additions & 0 deletions .devcontainer/on-create-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -exo pipefail

env

cd $OVERLAY_WS
. $UNDERLAY_WS/install/setup.sh

git config --global --add safe.directory "*"
colcon cache lock

colcon build \
--symlink-install \
--mixin $OVERLAY_MIXINS

sed --in-place \
's|^source .*|source "$OVERLAY_WS/install/setup.bash"|' \
/ros_entrypoint.sh
57 changes: 57 additions & 0 deletions .devcontainer/update-content-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

set -exo pipefail

env

cd $OVERLAY_WS

colcon cache lock

BUILD_UNFINISHED=$(
colcon list \
--names-only \
--packages-skip-build-finished \
| xargs)
echo BUILD_UNFINISHED: $BUILD_UNFINISHED

BUILD_FAILED=$(
colcon list \
--names-only \
--packages-select-build-failed \
| xargs)
echo BUILD_FAILED: $BUILD_FAILED

BUILD_INVALID=$(
colcon list \
--names-only \
--packages-select-cache-invalid \
--packages-select-cache-key build \
| xargs)
echo BUILD_INVALID: $BUILD_INVALID

BUILD_PACKAGES=""
if [ -n "$BUILD_UNFINISHED" ] || \
[ -n "$BUILD_FAILED" ] || \
[ -n "$BUILD_INVALID" ]
then
BUILD_PACKAGES=$(
colcon list \
--names-only \
--packages-above \
$BUILD_UNFINISHED \
$BUILD_FAILED \
$BUILD_INVALID \
| xargs)
fi
echo BUILD_PACKAGES: $BUILD_PACKAGES

colcon clean packages --yes \
--packages-select ${BUILD_PACKAGES} \
--base-select install

. $UNDERLAY_WS/install/setup.sh
colcon build \
--symlink-install \
--mixin $OVERLAY_MIXINS \
--packages-select ${BUILD_PACKAGES}
20 changes: 0 additions & 20 deletions .github/workflows/update_ci_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,3 @@ jobs:
- name: Image digest
if: steps.config.outputs.trigger == 'true'
run: echo ${{ steps.docker_build.outputs.digest }}
- name: Build and push ${{ github.ref_name }}-dev
if: steps.config.outputs.trigger == 'true'
id: docker_build_dev
uses: docker/build-push-action@v4
with:
pull: true
push: true
cache-from: |
type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}
type=registry,ref=ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev
cache-to: type=inline
build-args: |
RUN_TESTS=True
target: tester
tags: |
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev
ghcr.io/ros-planning/navigation2:${{ github.ref_name }}-dev-${{ steps.config.outputs.timestamp }}
- name: Image digest
if: steps.config.outputs.trigger == 'true'
run: echo ${{ steps.docker_build.outputs.digest }}