-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add GHA CI workflow Signed-off-by: Michel Hidalgo <[email protected]> * Fix dev container image Signed-off-by: Michel Hidalgo <[email protected]> * Add missing using directive Signed-off-by: Michel Hidalgo <[email protected]> * Add .gitignore file Signed-off-by: Michel Hidalgo <[email protected]> --------- Signed-off-by: Michel Hidalgo <[email protected]>
- Loading branch information
1 parent
8bdc969
commit c25a438
Showing
6 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG ROS_DISTRO=humble | ||
FROM ros:${ROS_DISTRO}-ros-base | ||
|
||
ENV ROS_DISTRO=${ROS_DISTRO} | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
# setup environment | ||
ENV LANG=C.UTF-8 | ||
ENV LC_ALL=C.UTF-8 | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
RUN DEBIAN_FRONTEND=noninteractive apt-get update -q && \ | ||
apt-get update -q && \ | ||
apt-get install -yq --no-install-recommends \ | ||
python3-pip \ | ||
python-is-python3 \ | ||
python3-argcomplete \ | ||
python3-colcon-common-extensions \ | ||
python3-colcon-mixin \ | ||
python3-pytest-cov \ | ||
python3-rosdep && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install dependencies for repository packages | ||
RUN --mount=type=bind,source=.,target=/tmp/context \ | ||
apt-get update -q && rosdep update && \ | ||
rosdep install -y -i --from-paths /tmp/context && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# ROS doesn't recognize the docker shells as terminals so force colored output | ||
ENV RCUTILS_COLORIZED_OUTPUT=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "proto2ros dev container", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": ".." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: proto2ros CI | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: bdaiinstitute/proto2ros_humble | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
concurrency: | ||
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.sha || ''}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Lint proto2ros packages | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- name: Lint sources | ||
uses: pre-commit/[email protected] | ||
prepare_container: | ||
name: Prepare Humble container for tests | ||
runs-on: ubuntu-latest | ||
needs: lint | ||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio when running outside of PRs. | ||
id-token: write | ||
outputs: | ||
image: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Docker buildx # to workaround: https://github.com/docker/build-push-action/issues/461 | ||
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf | ||
|
||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 # https://github.com/docker/login-action | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
uses: docker/metadata-action@v5 # https://github.com/docker/metadata-action | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
id: meta | ||
|
||
- name: Build and push Docker image (may be cached) | ||
uses: docker/build-push-action@v5 # https://github.com/docker/build-push-action | ||
with: | ||
context: . | ||
file: .devcontainer/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
build_and_test: | ||
name: Build and test proto2ros packages | ||
runs-on: ubuntu-latest | ||
needs: prepare_container | ||
container: | ||
image: ${{ needs.prepare_container.outputs.image }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build and run tests | ||
run: | | ||
source /opt/ros/humble/setup.bash | ||
colcon build --symlink-install | ||
source install/setup.bash | ||
colcon test --event-handlers console_direct+ | ||
colcon test-result --all --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: proto2ros CI maintenance | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * 0" # once a week | ||
|
||
env: | ||
ORG_NAME: bdaiinstitute | ||
IMAGE_NAME: proto2ros_humble | ||
|
||
jobs: | ||
clean-ghcr: | ||
name: Prune old images from Github Container Registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Delete old pull request images | ||
uses: snok/container-retention-policy@v2 | ||
with: | ||
image-names: ${{ env.IMAGE_NAME }} | ||
skip-tags: main | ||
cut-off: One week ago UTC | ||
org-name: ${{ env.ORG_NAME }} | ||
account-type: org | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
token-type: github-token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**/.mypy_cache | ||
**/__pycache__ | ||
**/*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters