Skip to content
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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "ROS 2 Humble Devcontainer",
"name": "ROS 2 Devcontainer",
"build": {
"dockerfile": "./Dockerfile",
"args": {
Expand Down
151 changes: 76 additions & 75 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,87 @@
name: Docker Image CI

on:
push:
branches: ["main"]
# ensure that version tags also trigger a build, naming convention is `vX.Y.Z`
# make sure the naming convention is followed in tags.
tags:
- "v*"
pull_request:
branches: ["main"]
# permit manual trigger as well
workflow_dispatch:
push:
branches: ["main"]
# ensure that version tags also trigger a build, naming convention is `vX.Y.Z`
# make sure the naming convention is followed in tags.
tags:
- "v*"
pull_request:

workflow_dispatch:

jobs:
build:
# this only works on jabasai organisation and should be skipped otherwise
if: github.repository_owner == 'jabasai'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
build:
runs-on: ubuntu-latest

env: # set the ROS distribution to be used in the devcontainer, e.g. humble or iron
ROS_DISTRO: humble

permissions:
contents: read
packages: write

steps:
- name: Git Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1
steps:
- name: Git Checkout
uses: actions/checkout@v5
with:
fetch-depth: 1

# log in to GitHub Container Registry with correct permission
# only works within jabasai organisation and NOT on forks
- name: Docker Login GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# log in to GitHub Container Registry with correct permission
- name: Docker Login GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# create a docker image name from the github repository name, ensuring lower case and no disallowed characters
- name: create docker image name from github name
id: docker-image-name
run: |
repo_name=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '. ' '-')
echo "image_name=$repo_name" >> $GITHUB_OUTPUT
# create a docker image name from the github repository name, ensuring lower case and no disallowed characters
- name: create docker image name from github name
id: docker-image-name
run: |
repo_name=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '. ' '-')
echo "image_name=$repo_name" >> $GITHUB_OUTPUT

# set the relevant docker tags and labels
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
org.opencontainers.image.version=${{ github.ref_name }}
images: |
ghcr.io/${{ steps.docker-image-name.outputs.image_name }}
flavor: |
latest=auto
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
# set the relevant docker tags and labels
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.creator=${{ github.repository_owner }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
org.opencontainers.image.version=${{ github.ref_name }}
images: |
ghcr.io/${{ steps.docker-image-name.outputs.image_name }}
flavor: |
latest=auto
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch

- name: setup buildx
uses: docker/setup-buildx-action@v2
- name: setup buildx
uses: docker/setup-buildx-action@v4

- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
file: ./.devcontainer/Dockerfile
platforms: linux/amd64 # add other platforms if needed
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: final
build-args: |
BASE_IMAGE=ros:humble
GIT_REPO_VERSION=${{ github.ref_name }}
GIT_REPO_VERSION_DATE=${{ github.event.head_commit.timestamp }}
- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
file: ./.devcontainer/Dockerfile
platforms: linux/amd64 # add other platforms if needed
cache-from: type=gha
cache-to: type=gha,mode=max
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: final
build-args: |
BASE_IMAGE=ros:${{ env.ROS_DISTRO }}
GIT_REPO_VERSION=${{ github.ref_name }}
GIT_REPO_VERSION_DATE=${{ github.event.head_commit.timestamp }}
13 changes: 9 additions & 4 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ on:

jobs:
copilot-setup-steps:
# ensure this matches the target platform for your development environment, e.g. if you are using a devcontainer with Ubuntu 22.04, use ubuntu-22.04 here as well.
runs-on: ubuntu-22.04
permissions:
contents: read

env:
# set the ROS distribution to be used in the setup steps, e.g. humble or iron
ROS_DISTRO: humble

steps:
- uses: actions/checkout@v3

Expand All @@ -29,12 +34,12 @@ jobs:
- name: install workspace dependencies
run: |
sudo apt-get update
sudo apt-get install -y ros-humble-ros-base
source /opt/ros/humble/setup.bash
rosdep update --rosdistro humble
sudo apt-get install -y ros-${ROS_DISTRO}-ros-base
source /opt/ros/${ROS_DISTRO}/setup.bash
rosdep update --rosdistro ${ROS_DISTRO}
rosdep install --from-paths src --ignore-src -r -y

- name: build workspace
run: |
source /opt/ros/humble/setup.bash
source /opt/ros/${ROS_DISTRO}/setup.bash
colcon build --symlink-install --continue-on-error
15 changes: 11 additions & 4 deletions .github/workflows/dev-container.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
name: 'devcontainer CI'
on:
workflow_dispatch:

pull_request:
branches:
- main
paths:
- '.devcontainer/**'
- '.github/workflows/dev-container.yml'

push:
branches:
- main
paths:
- '.devcontainer/**'
- '.github/workflows/dev-container.yml'

jobs:
build_devcontainer:
runs-on: ubuntu-latest
steps:
- name: Checkout from github
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: extract the github reference
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: "image name from repo name"
id: docker_image_name
run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT}
- name: setup buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v4

- name: Build and run dev container task
uses: devcontainers/ci@v0.3
with:
Expand Down
25 changes: 3 additions & 22 deletions .github/workflows/ros-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ on:
# you may want to configure the branches that this should be run on here.
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
test_docker: # On Linux, iterates on all ROS 1 and ROS 2 distributions.
runs-on: ubuntu-latest
strategy:
matrix:
ros_distribution:
# - noetic
- humble
# - iron

# Define the Docker image(s) associated with each ROS distribution.
# The include syntax allows additional variables to be defined, like
Expand All @@ -34,12 +29,6 @@ jobs:
# Humble Hawksbill (May 2022 - May 2027)
- docker_image: ubuntu:jammy
ros_distribution: humble
ros_version: 2

# Iron Irwini (May 2023 - November 2024)
# - docker_image: ubuntu:jammy
# ros_distribution: iron
# ros_version: 2

# # Rolling Ridley (No End-Of-Life)
# - docker_image: ubuntu:jammy
Expand All @@ -49,20 +38,12 @@ jobs:
container:
image: ${{ matrix.docker_image }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: setup ROS environment
uses: ros-tooling/setup-ros@v0.7
#with:
# required-ros-distributions: ${{ matrix.ros_distribution }}
- name: build and test ROS 1
if: ${{ matrix.ros_version == 1 }}
uses: ros-tooling/action-ros-ci@v0.3
with:
import-token: ${{ github.token }}
target-ros1-distro: ${{ matrix.ros_distribution }}
skip-tests: true

- name: build and test ROS 2
if: ${{ matrix.ros_version == 2 }}
uses: ros-tooling/action-ros-ci@v0.3
with:
import-token: ${{ github.token }}
Expand Down
Loading