Skip to content

Merge pull request #9 from NovoG93/dependabot/github_actions/schneega… #9

Merge pull request #9 from NovoG93/dependabot/github_actions/schneega…

Merge pull request #9 from NovoG93/dependabot/github_actions/schneega… #9

Workflow file for this run

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@v4
- 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@v5
with:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sjtu_drone:ros2