Skip to content

Commit

Permalink
Update workflows to use self-hosted runner (#39)
Browse files Browse the repository at this point in the history
* Création et configuration d'une machine de test et compilation (build machine)

* Update GitHub Actions workflow to use actions/checkout@v3 and add build step for rove

---------

Co-authored-by: Charles <charles-albert.choupin@transports.gouv.qc.ca>
  • Loading branch information
Leuchak and cchoupin authored Apr 6, 2024
1 parent 759801e commit 03207f4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
17 changes: 9 additions & 8 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG USER_GID=$USER_UID

WORKDIR /workspace/$USERNAME

RUN groupadd --gid $USER_GID $USERNAME \
RUN groupadd --gid $USER_GID $USERNAME || true \
&& groupadd -g 107 input \
&& useradd -s /bin/bash --uid $USER_UID -g $USER_GID -G 107 -m $USERNAME \
&& apt-get update \
Expand All @@ -22,16 +22,17 @@ RUN apt update && apt upgrade -y
# Install Git
RUN apt install -y git

# Copy to preload the ros packages
COPY ./ /workspace/$USERNAME/

# Change user
USER $USERNAME

# Rosdep update
# Source the ROS setup file
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc && \
echo "source /gazebo/gazebo_ws/install/setup.bash" >> ~/.bashrc

# Install ROS dependencies
RUN rosdep update
# Copy to preload the ros packages
COPY ./ /workspace/$USERNAME/

RUN rosdep install --from-paths src --ignore-src --rosdistro humble -y

# Source the ROS setup file
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc
RUN echo "source /gazebo/gazebo_ws/install/setup.bash" >> ~/.bashrc
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/
log/
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ run-name: ${{ github.actor }} is working on ROS2 rove build
on: [push]
jobs:
Build_rove:
runs-on: ubuntu-latest
runs-on: [self-hosted, linux, docker]
permissions:
packages: write
contents: read

steps:
- name: Check out the repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Build docker compose
run: |
docker compose run --user root devcontainer bash -c "colcon build"
docker compose build --build-arg USER_UID=$(id -u) --build-arg USER_GID=$(id -g)
- name: Build rove
run: |
docker compose run devcontainer bash -c "colcon build"
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ services:
build:
context: .
dockerfile: ./.devcontainer/Dockerfile
args:
- USER_UID=${USER_UID:-1000}
- USER_GID=${USER_GID:-1000}
volumes:
- ./:/workspace/rove
- /tmp/.X11-unix:/tmp/.X11-unix
Expand Down

0 comments on commit 03207f4

Please sign in to comment.