-
Notifications
You must be signed in to change notification settings - Fork 21
88 lines (82 loc) · 2.51 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: test
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
env:
RETRY-TEST-NUM: 10
jobs:
test:
runs-on: ubuntu-22.04
timeout-minutes: 5
container: osrf/ros:humble-desktop-full
steps:
- uses: actions/checkout@v2
- name: Apt update install
run: |
sudo apt update -y
sudo apt install -y \
psmisc \
rsync \
xvfb \
ros-$ROS_DISTRO-navigation2 \
ros-$ROS_DISTRO-nav2-bringup \
ros-$ROS_DISTRO-turtlebot3-gazebo
- name: Build
run: |
mkdir -p /root/ros2_ws/src/emcl2_ros2/
rsync -av ./ /root/ros2_ws/src/emcl2_ros2/
cd /root/ros2_ws
source /opt/ros/$ROS_DISTRO/setup.bash
rosdep update
rosdep install -i -y --from-path src --rosdistro $ROS_DISTRO
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
shell: bash
- name: Exec
run: |
source /root/ros2_ws/install/setup.bash
ros2 run emcl2 test.bash
shell: bash
retry:
runs-on: ubuntu-22.04
needs: test
if: ${{ always() && needs.test.result == 'failure' }}
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
async function run() {
const { owner, repo } = context.repo;
const workflow_id = 'rerun.yml';
const ref = ('${{ github.head_ref }}' === '' || '${{ github.head_ref }}' === 'main') ? 'main' : '${{ github.head_ref }}';
const run_id = context.runId;
try {
const workflow_run = await github.rest.actions.getWorkflowRun({
owner,
repo,
run_id
});
if (workflow_run.data.run_attempt < ${{ env.RETRY-TEST-NUM }}) {
console.log('Triggering workflow dispatch...');
await github.rest.actions.createWorkflowDispatch({
owner,
repo,
workflow_id,
ref
});
} else {
console.log('Conditions not met for re-dispatch.');
}
} catch (error) {
console.error('Failed to fetch workflow run or dispatch:', error);
}
}
run();