Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): change way to modified files for cppcheck #34

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/cppcheck-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,19 @@
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set PR fetch depth
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"

- name: Checkout PR branch and all PR commits
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake git libpcre3-dev

Check warning on line 23 in .github/workflows/cppcheck-differential.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (libpcre)

# cppcheck from apt does not yet support --check-level args, and thus install from source
- name: Install Cppcheck from source
Expand All @@ -26,15 +32,19 @@
mkdir build
cd build
cmake ..
make -j $(nproc)

Check warning on line 35 in .github/workflows/cppcheck-differential.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (nproc)
sudo make install

- name: Fetch the base branch with enough history for a common merge-base commit
run: git fetch origin ${{ inputs.base-ref }}
shell: bash

- name: Get changed files
id: changed-files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only FETCH_HEAD ${{ github.sha }} > changed_files.txt
git diff --name-only "origin/${{ inputs.base-ref }}"...HEAD > changed_files.txt
cat changed_files.txt
shell: bash

- name: Run Cppcheck on changed files
continue-on-error: true
Expand Down
Loading