CI: Switch to actions/cache #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) | |
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
ici: | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- ROS_DISTRO: noetic | |
CLANG_TIDY: true | |
TARGET_CMAKE_ARGS: >- | |
-DCMAKE_BUILD_TYPE=Release | |
-DCMAKE_CXX_FLAGS="-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls" | |
env: | |
CATKIN_LINT: true | |
CLANG_TIDY_ARGS: -quiet -export-fixes ${{ github.workspace }}/.work/clang-tidy-fixes.yaml | |
CCACHE_DIR: ${{ github.workspace }}/.ccache | |
BASEDIR: ${{ github.workspace }}/.work | |
CACHE_PREFIX: "${{ matrix.env.ROS_DISTRO }}${{ contains(matrix.env.TARGET_CMAKE_ARGS, '--coverage') && '-ccov' || '' }}" | |
# perform full clang-tidy check only on manual trigger (workflow_dispatch), PRs do check changed files, otherwise nothing | |
CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }} | |
CC: ${{ matrix.env.CLANG_TIDY && 'clang' }} | |
CXX: ${{ matrix.env.CLANG_TIDY && 'clang++' }} | |
ADDITIONAL_DEBS: ${{ matrix.env.CLANG_TIDY && 'clang' }} | |
name: "${{ matrix.env.ROS_DISTRO }}${{ matrix.env.NAME && ' • ' || ''}}${{ matrix.env.NAME }}${{ matrix.env.CATKIN_LINT && ' • catkin_lint' || ''}}${{ matrix.env.CLANG_TIDY && ' • clang-tidy' || '' }}" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
save-always: true | |
path: ${{ env.CCACHE_DIR }} | |
key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }} | |
restore-keys: | | |
ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }} | |
ccache-${{ env.CACHE_PREFIX }} | |
- id: ici | |
name: Run industrial_ci | |
uses: rhaschke/industrial_ci@master | |
env: ${{ matrix.env }} | |
- name: Upload clang-tidy fixes (on failure) | |
uses: actions/upload-artifact@v4 | |
if: failure() && steps.ici.outputs.clang_tidy_checks | |
with: | |
name: clang-tidy-fixes.yaml | |
path: ${{ env.BASEDIR }}/clang-tidy-fixes.yaml |