Skip to content

Added github actions for build and clang-tidy/format. #2

Added github actions for build and clang-tidy/format.

Added github actions for build and clang-tidy/format. #2

Workflow file for this run

name: clang-tidy-review
# You can be more specific, but it currently only works on pull requests
on: [pull_request]
jobs:
clang-tidy:
runs-on: ubuntu-latest
container: ros:humble
outputs:
output1: ${{ steps.target-files.outputs.all }}
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Restore build cache
id: cache-build-restore
uses: actions/cache/restore@v4
with:
path: |
$HOME/atos_ws/build
$HOME/atos_ws/install
key: ${{ runner.os }}-build
- name: Install ATOS
run: |
./setup_atos.sh
shell: bash
- name: Save build cache
id: cache-build-save
uses: actions/cache/save@v4
with:
path: |
$HOME/atos_ws/build
$HOME/atos_ws/install
key: ${{ steps.cache-build-restore.outputs.cache-primary-key }}
- name: Install Clang-Tidy
run: |
sudo apt-get -yqq update
sudo apt-get -yqq install clang-tidy libomp-dev
shell: bash
- name: Get changed files
id: target-files
uses: jitterbit/get-changed-files@v1
- run: |
echo ${{ steps.target-files.outputs.all }}
shell: bash
- name: Analyze
if: ${{ steps.target-files.outputs.all != '' }}
run: |
mkdir /tmp/clang-tidy-result
clang-tidy -p build/ -export-fixes /tmp/clang-tidy-result/fixes.yaml ${{ steps.target-files.outputs.all }} || true
echo "${{ github.event.number }}" > /tmp/clang-tidy-result/pr-id.txt
echo "${{ github.event.pull_request.head.repo.full_name }}" > /tmp/clang-tidy-result/pr-head-repo.txt
echo "${{ github.event.pull_request.head.ref }}" > /tmp/clang-tidy-result/pr-head-ref.txt
shell: bash
- name: Check if the fixes.yaml file exists
id: check-fixes-yaml-existence
uses: autowarefoundation/autoware-github-actions/check-file-existence@v1
with:
files: /tmp/clang-tidy-result/fixes.yaml
- name: Upload artifacts
if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }}
uses: actions/upload-artifact@v4
with:
name: clang-tidy-result
path: /tmp/clang-tidy-result/
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/[email protected]
with:
clang-format-version: '13'
check-path: ${{ steps.target-files.outputs.all }}