Skip to content

Commit

Permalink
run infer only when compile commands were produced
Browse files Browse the repository at this point in the history
Signed-off-by: Max SCHMELLER <[email protected]>
  • Loading branch information
mojomex committed Dec 3, 2024
1 parent 47f8f4b commit 8c1c514
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build-and-test-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
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:
Expand All @@ -38,6 +39,7 @@ jobs:
build-depends-repos: ${{ matrix.build-depends-repos }}

- name: Upload compilation database
if: ${{ steps.build.outcome == 'success' }}
id: upload-compile-db
uses: actions/upload-artifact@v4
with:
Expand All @@ -47,7 +49,7 @@ jobs:

- name: Test
id: test
if: ${{ steps.get-modified-packages.outputs.modified-packages != '' }}
if: ${{ steps.build.outcome == 'success' }}
uses: autowarefoundation/autoware-github-actions/colcon-test@v1
with:
rosdistro: ${{ matrix.rosdistro }}
Expand All @@ -67,29 +69,33 @@ jobs:
fb-infer-differential:
runs-on: ubuntu-latest
needs: [build-and-test-differential]
if: ${{ needs.build-and-test-differential.result }}
steps:
- name: Download compilation database
id: download-compile-db
uses: actions/download-artifact@v4
with:
name: compilation-database-diff-${{ github.head_ref }}

- name: Install FB Infer
id: fb-infer-install
if: ${{ steps.download-compile-db.outcome == 'success' }}
env:
VERSION: 1.2.0
run: |
curl -sSL "https://github.com/facebook/infer/releases/download/v$VERSION/infer-linux-x86_64-v$VERSION.tar.xz" \
sudo ln -s "infer-linux-x86_64-v$VERSION/bin/infer" ./infer
- name: Download compilation database
id: download-compile-db
uses: actions/download-artifact@v4
with:
name: compilation-database-diff-${{ github.head_ref }}

- name: Run FB Infer
id: fb-infer-run
if: ${{ steps.fb-infer-install.outcome == 'success' }}
run: |
git diff --name-only ${{ github.head_ref }}..${{ github.base_ref }} > changed-files.txt
infer run --changed-files-index changed-files.txt --compilation-database ./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 }}
Expand Down

0 comments on commit 8c1c514

Please sign in to comment.