Skip to content

ci: introduce Facebook Infer job #1301

ci: introduce Facebook Infer job

ci: introduce Facebook Infer job #1301

name: build-and-test-differential
on:
pull_request:
jobs:
build-and-test-differential:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
rosdistro:
- humble
include:
- rosdistro: humble
container: ros:humble
build-depends-repos: build_depends.repos
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Remove exec_depend
uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1
- name: Get modified packages
id: get-modified-packages
uses: autowarefoundation/autoware-github-actions/get-modified-packages@v1
- name: Build
id: build
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
uses: autowarefoundation/autoware-github-actions/colcon-build@v1
with:
rosdistro: ${{ matrix.rosdistro }}
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}
- name: Upload build artifacts for static analysis
if: ${{ steps.build.outcome == 'success' }}
uses: actions/upload-artifact@v4
with:
name: static-analysis-resources-${{ github.sha }}
path: |
build/compile_commands.json
build/**/*.c
build/**/*.cc
build/**/*.cpp
build/**/*.h
build/**/*.hh
build/**/*.hpp
dependency_ws/
if-no-files-found: error
- name: Test
id: test
if: ${{ steps.build.outcome == 'success' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: ${{ matrix.rosdistro }}
target-packages: ${{ steps.get-modified-packages.outputs.modified-packages }}
build-depends-repos: ${{ matrix.build-depends-repos }}
- name: Upload coverage to CodeCov
if: ${{ steps.test.outputs.coverage-report-files != '' }}
uses: codecov/codecov-action@v4
with:
files: ${{ steps.test.outputs.coverage-report-files }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
flags: differential
fb-infer-differential:
runs-on: ubuntu-latest
needs: [build-and-test-differential]
if: ${{ needs.build-and-test-differential.result }}
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download static analysis resources
id: download-compile-db
uses: actions/download-artifact@v4
with:
name: static-analysis-resources-${{ github.sha }}
continue-on-error: true
- name: Install FB Infer
id: fb-infer-install
if: ${{ steps.download-compile-db.outcome == 'success' }}
env:
VERSION: 1.2.0
run: |
wget https://github.com/facebook/infer/releases/download/v${VERSION}/infer-linux-x86_64-v${VERSION}.tar.xz
tar -xvf infer-linux-x86_64-v${VERSION}.tar.xz
sudo mv infer-linux-x86_64-v${VERSION} /usr/local/infer
echo "PATH=/usr/local/infer/bin:$PATH" >> $GITHUB_ENV
- name: Debug log
run: |
pwd
ls -R
- name: Run FB Infer
id: fb-infer-run
if: ${{ steps.fb-infer-install.outcome == 'success' }}
run: |
infer run --compilation-database build/compile_commands.json
- name: Upload FB Infer Report
id: fb-infer-upload
if: ${{ steps.fb-infer-run.outcome == 'success' }}
uses: actions/upload-artifact@v4
with:
name: infer-report-diff-${{ github.head_ref }}
path: infer-out/report.*
if-no-files-found: error