ci: introduce Facebook Infer job #1310
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
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: 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 | |
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: Install Clang-15 | |
run: | | |
sudo apt-get -yqq update | |
sudo apt-get -yqq install --install-recommends clang-15 clang-tidy-15 clangd-15 | |
sudo apt-get -yqq install clang-15-doc wasi-libc llvm-15-doc | |
sudo apt-get -yqq install libomp-15-dev libomp-15-doc # For OpenMP support in Clang | |
sudo apt-get -yqq install libstdc++-12-dev | |
echo "CC=/usr/bin/clang-15" >> $GITHUB_ENV | |
echo "CXX=/usr/bin/clang++-15" >> $GITHUB_ENV | |
- name: Install FB Infer | |
id: fb-infer-install | |
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }} | |
env: | |
VERSION: 1.2.0 | |
run: | | |
export BASENAME="infer-linux-x86_64-v${VERSION}" | |
export FILENAME="${BASENAME}.tar.xz" | |
sudo apt-get -yqq install curl tar | |
curl -sSLO "https://github.com/facebook/infer/releases/download/v${VERSION}/${FILENAME}" | |
tar -xf "$FILENAME" | |
rm "$FILENAME" | |
sudo mv "$BASENAME" /usr/local/infer | |
echo "PATH=/usr/local/infer/bin:$PATH" >> $GITHUB_ENV | |
- 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: Debug log | |
run: | | |
pwd | |
ls -R | |
- name: Run FB Infer | |
id: fb-infer-run | |
if: ${{ steps.build.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.sha }} | |
path: infer-out/report.* | |
if-no-files-found: error |