diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index afaea8f..e344725 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -31,6 +31,9 @@ RUN echo "source /opt/ros/humble/setup.sh" >> /root/.bashrc RUN . /opt/ros/humble/setup.sh && colcon build RUN echo "source /ros_deps/install/setup.sh" >> /root/.bashrc +ENV CARGO_TERM_COLOR=always +ENV RUSTFLAGS="-Dwarnings" + RUN mkdir -p /workspace WORKDIR /workspace @@ -39,3 +42,4 @@ COPY entrypoint.sh / RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] +CMD ["/bin/bash"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 531d797..087ac67 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,6 +5,8 @@ "dockerfile": "Dockerfile" }, "runArgs": ["-v", ".:/workspace"], + "overrideCommand": true, + "postStartCommand": ". /entrypoint.sh", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh index 4664f3f..09f362f 100644 --- a/.devcontainer/entrypoint.sh +++ b/.devcontainer/entrypoint.sh @@ -1,6 +1,9 @@ #!/bin/bash # Build the package mounted in the container +echo "Building workspace with colcon" . /opt/ros/humble/setup.sh && . /ros_deps/install/setup.sh && colcon build echo "source /workspace/install/setup.sh" >> /root/.bashrc -/bin/bash \ No newline at end of file + +# Run the CMD (either the default from the Dockerfile or the one provided as docker run argument) +exec "$@" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ee124cc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + pull_request: + +jobs: + build_dev_container: + uses: ./.github/workflows/ci_build_dev_container.yml + build: + needs: build_dev_container + uses: ./.github/workflows/ci_build.yml + test: + needs: build_dev_container + uses: ./.github/workflows/ci_test.yml + lint: + needs: build_dev_container + uses: ./.github/workflows/ci_lint.yml + diff --git a/.github/workflows/ci_build.yml b/.github/workflows/ci_build.yml new file mode 100644 index 0000000..243a450 --- /dev/null +++ b/.github/workflows/ci_build.yml @@ -0,0 +1,25 @@ +name: CI Build + +on: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Checkout (GitHub) + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Cargo build + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + runCmd: cargo build --verbose diff --git a/.github/workflows/ci_build_dev_container.yml b/.github/workflows/ci_build_dev_container.yml new file mode 100644 index 0000000..000d063 --- /dev/null +++ b/.github/workflows/ci_build_dev_container.yml @@ -0,0 +1,25 @@ +name: CI build dev container + +on: + workflow_call: + +jobs: + build_dev_container: + runs-on: ubuntu-latest + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pre-build dev container image + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + cacheFrom: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + push: always diff --git a/.github/workflows/ci_lint.yml b/.github/workflows/ci_lint.yml new file mode 100644 index 0000000..994cc26 --- /dev/null +++ b/.github/workflows/ci_lint.yml @@ -0,0 +1,25 @@ +name: CI Lint + +on: + workflow_call: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + + - name: Checkout (GitHub) + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Cargo Clippy + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + runCmd: cargo clippy --all-targets --all-features diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml new file mode 100644 index 0000000..16debd0 --- /dev/null +++ b/.github/workflows/ci_test.yml @@ -0,0 +1,25 @@ +name: CI Test + +on: + workflow_call: + +jobs: + test: + runs-on: ubuntu-latest + steps: + + - name: Checkout (GitHub) + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Cargo test + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/vorausrobotik/voraus-ros-bridge-dev + runCmd: cargo test --verbose diff --git a/README.md b/README.md index e6be6d7..1618cc9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![CI](https://github.com/vorausrobotik/voraus-ros-bridge/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/vorausrobotik/voraus-ros-bridge/actions/workflows/ci.yml) + # voraus-ros-bridge Enables `voraus.core` integration within the ROS framework.