Skip to content

Commit

Permalink
Addressed the comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBearing committed Sep 29, 2024
1 parent 8eca2c7 commit bc50df8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 34 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/humble_docker_test.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
name: Humble_test_with_docker_NativeROS_string
name: buid_and_test_with_docker_NativeROS_string

on:
push:
branches:
- "main"
pull_request:
types: [opened, synchronize, labeled]
types: [opened, synchronize]
jobs:
ci:
runs-on: ${{ matrix.os }}
if: |
((github.event.action == 'labeled') && (github.event.label.name == 'TESTING') && (github.base_ref == 'main' )) ||
((github.event.action == 'synchronize') && (github.base_ref == 'main') && contains(github.event.pull_request.labels.*.name, 'TESTING')) ||
(github.ref_name == 'main')
runs-on: ubuntu-latest
container:
image: osrf/ros:${{ matrix.ros_distribution }}-desktop
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
ros_distribution: [humble]
steps:
- name: Checkout code
Expand All @@ -31,14 +26,14 @@ jobs:

- name: Install Docker Compose
run: sudo apt-get update && sudo apt-get install -y docker-compose
# docker-compose.yml を使ってコンテナを起動
# runs containers using docker-compose.yml
- name: Build and run containers
run: docker-compose up -d
- name: Wait for containers to start
run: sleep 20 # コンテナが確実に起動するのを待つ時間を長くする
run: sleep 20 # wait time for container startup.
- name: List running containers
run: docker ps -a # 全コンテナが起動しているか確認
- name: Show container logs # コンテナのログを確認する
run: docker ps -a # Check if all containers are running.
- name: Show container logs
run: |
docker logs app1
docker logs app2
Expand All @@ -56,15 +51,15 @@ jobs:
docker exec -d app2 bash -c "nc -l -p 8080"
# app1からapp2へのTCP接続を確認
docker exec app1 bash -c "echo 'Test' | nc -w 3 172.19.0.3 8080"
# app1: ビルドの準備 (chmod +x update_ip.sh と ./update_ip.sh の実行)
# app1: prepare build (chmod +x update_ip.sh と ./update_ip.sh の実行)
- name: Prepare build in mros
run: |
docker cp $GITHUB_WORKSPACE app1:/root/ws_mros # ソースコードをapp1コンテナにコピー
docker exec app1 bash -c "
cd /root/ws_mros &&
chmod +x update_ip.sh && # 権限変更
./update_ip.sh" # IPアドレス更新スクリプトの実行
# app1: クリーンビルド
# app1: clean and build
- name: Clean and build in mros
run: |
docker exec app1 bash -c "
Expand All @@ -73,7 +68,7 @@ jobs:
ls -la &&
bash build.bash clean && # クリーンアップ
bash build.bash all test_echoback_string"
# app2: のコードをコンテナにコピーしてビルド
# app2:
- name: Clone Native test stub source code to app2 and build and run
run: |
docker exec app2 bash -c "
Expand Down
32 changes: 14 additions & 18 deletions .github/workflows/humble_test.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
name: ci_humble
#TODO fix file name and "name:" like "build and test"

name: build_and_test

on:
push:
branches:
- "main"
- "feat/add_ci_config"
pull_request:
types: [opened, synchronize, labeled]
types: [opened, synchronize ]
jobs:
ci:
runs-on: ${{ matrix.os }}
if: |
((github.event.action == 'labeled') && (github.event.label.name == 'TESTING') && (github.base_ref == 'main' )) ||
((github.event.action == 'synchronize') && (github.base_ref == 'main') && contains(github.event.pull_request.labels.*.name, 'TESTING')) ||
(github.ref_name == 'main')
build_and_test:
runs-on: ubuntu-latest
container:
image: osrf/ros:${{ matrix.ros_distribution }}-desktop
timeout-minutes: 3
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
ros_distribution: [humble]
comm-target: [native , mros]
comm-data-type: [string, twist]
Expand Down Expand Up @@ -74,19 +70,19 @@ jobs:
shell: bash
run : |
./test_echoback_${{ matrix.comm-data-type }}/mros2-posix &
mros_pid=$! # mROSのプロセスIDを取得
mros_pid=$! # get mROS process id
# Native ROSをバックグラウンドで実行
# Run Native ROS in background
cd ws_host/
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 run mros2_echoreply_${{ matrix.comm-data-type }} echoreply_node &
# mROSが終了するまで待つ
# Wait until mROS finishes
wait $mros_pid
mros_status=$?
# 結果に基づいてCIの成否を判断
# Judge CI success based on results
if [ $mros_status -eq 0 ] ;then
echo "Succeed pub/sub test process between mros2 and Native ROS"
exit 0
Expand All @@ -99,16 +95,16 @@ jobs:
shell: bash
run : |
./test_echoback_${{ matrix.comm-data-type }}/mros2-posix &
mros_pid=$! # テストプログラムのプロセスIDを取得
mros_pid=$! # get mROS process id
# テスト対象をバックグラウンドで実行
# Run mROS responder in background
./cmake_build/mros2-posix &
# mROSが終了するまで待つ
# Wait until mROS finishes
wait $mros_pid
mros_status=$?
# 結果に基づいてCIの成否を判断
# Judge CI success based on results
if [ $mros_status -eq 0 ] ;then
echo "Succeed pub/sub test process between mros2 and Native ROS"
exit 0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ sudo apt-get update && sudo apt-get install -y \
libssl-dev libreadline-dev zlib1g-dev \
make autoconf automake cmake \
pkg-config curl \
net-tools netcat jinja2
net-tools netcat python3-jinja2
```

Please check the IP address and netmask of the execution environment.
Expand Down

0 comments on commit bc50df8

Please sign in to comment.