Skip to content

Commit

Permalink
Use CI template
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo authored Nov 3, 2024
1 parent 734b58e commit c7645f9
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)
# For troubleshooting, see README (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)

name: Build and Test
name: CI

# This determines when this workflow is run
on:
workflow_dispatch:
pull_request:
on: # this determines when this workflow is run
push:
branches:
- main
# branches: [ master, melodic-devel ] # when master or melodic-devel branch is pushed to
pull_request:
# branches: [ master ] # when there is a pull request against master
# schedule: # uncomment to run periodically
# - cron: '0 4 * * *' # every day at 4 AM (UTC)
workflow_dispatch: # allow manually starting this workflow

jobs:
industrial_ci:
name: ROS ${{ matrix.ROS_DISTRO }} (${{ matrix.ROS_REPO }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rosdistro: [humble, jazzy]

# fail-fast: false # uncomment if failing jobs should not cancel the others immediately
matrix: # matrix is the product of entries
ROS_DISTRO: [humble, jazzy]
ROS_REPO: [testing, main]
# exclude: # specific configuration can be excludes
# - {ROS_DISTRO: melodic, ROS_REPO: testing}
env:
CCACHE_DIR: /github/home/.ccache
CXXFLAGS: "-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls"

ROS_DISTRO: ${{ matrix.env.rosdistro }}

runs-on: ubuntu-latest
CCACHE_DIR: "${{ github.workspace }}/.ccache" # directory for ccache (and how we enable ccache in industrial_ci)
steps:
- uses: actions/checkout@v4
# This step will fetch/store the directory used by ccache before/after the ci run
- uses: actions/cache@v4
- uses: actions/checkout@v4 # clone target repository
- uses: actions/cache@v2 # fetch/store the directory used by ccache before/after the ci run
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-{{ matrix.env.ROS_DISTRO }}-{{ matrix.env.ROS_REPO }}
# Run industrial_ci
- uses: 'ros-industrial/industrial_ci@master'
env:
# This configuration will always create a new ccache cache starting off from the previous one (if any).
# In this simple version it will be shared between all builds of the same ROS_REPO and ROS_REPO
# and might need some fine-tuning to match the use case
key: ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-${{github.run_id}}
restore-keys: |
ccache-${{ matrix.ROS_DISTRO }}-${{ matrix.ROS_REPO }}-
- uses: 'ros-industrial/industrial_ci@master' # run industrial_ci
env: # either pass all entries explicitly
ROS_DISTRO: ${{ matrix.ROS_DISTRO }}
ROS_REPO: main
ROS_REPO: ${{ matrix.ROS_REPO }}
# with: # or pass the full matrix as config
# config: ${{toJSON(matrix)}}

0 comments on commit c7645f9

Please # to comment.