-
Notifications
You must be signed in to change notification settings - Fork 64
93 lines (81 loc) · 2.67 KB
/
CI_CD.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
89
90
91
92
93
name: Build and Deploy
on:
"push":
branches: [ros2]
jobs:
build:
name: Build and test on ros ${{ matrix.ros_distribution }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# - os: ubuntu-20.04
# ros_distribution: "galactic"
- os: ubuntu-22.04
ros_distribution: "humble"
- os: ubuntu-22.04
ros_distribution: "rolling"
fail-fast: false
outputs:
build_step_outcome: ${{ steps.build_step.outcome }}
steps:
- name: Setup ROS2 ${{ matrix.ros_distribution }}
uses: ros-tooling/[email protected]
with:
required-ros-distributions: ${{ matrix.ros_distribution }}
- name: Build
id: build_step
uses: ros-tooling/[email protected]
with:
target-ros2-distro: ${{ matrix.ros_distribution }}
skip-tests: true
- name: Set Badge Message
id: set_badge_message
run: |
if [ ${{ steps.build_step.outcome }} == "success" ]; then
echo "BUILD_STATUS=success" >> $GITHUB_ENV
else
echo "BUILD_STATUS=failure" >> $GITHUB_ENV
fi
- name: Create Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 589e4b4dc8d92861e4b92defff6d56c0
filename: ${{ env.GITHUB_REPOSITORY_ID }}_${{ matrix.ros_distribution }}_build.json
label: ${{ matrix.ros_distribution }}
message: ${{ env.BUILD_STATUS }}
color: green
- name: Test
continue-on-error: true
uses: ros-tooling/[email protected]
with:
target-ros2-distro: ${{ matrix.ros_distribution }}
skip-tests: false
- name: Upload logs
uses: actions/upload-artifact@v3
with:
name: colcon-logs
path: ${{ steps.action_ros_ci_step.outputs.ros-workspace-directory-name }}/log
if: always()
deploy:
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.build_step_outcome == 'success'
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sjtu_drone:ros2