Skip to content
Merged
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
35 changes: 4 additions & 31 deletions pre-commit/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,20 @@ runs:
cache: "pip"
cache-dependency-path: ".pre-commit-config.yaml"

- name: Step up Cppcheck cache
id: cache-cppcheck
if: ${{ inputs.use_cppcheck == "true" && inputs.use_cache == "true" }}
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.cache/cppcheck
key: cppcheck-${{ runner.os }}-v2.13.0

- name: Set up Cppcheck
if: ${{ inputs.use_cppcheck == "true" && steps.cache-cppcheck.outputs.cache-hit != "true" }}
if: inputs.use_cppcheck == 'true'
shell: bash
run: |
mkdir -p ${{ github.workspace }}/.cache/cppcheck
sudo apt-get -qq update

# Set up temp directory
temp_dir=$(mktemp -d) && cd temp_dir

# Download and extract Cppcheck
sudo apt-get download -qq -y cppcheck
dpkg-deb -x cppcheck_*.deb ${{ github.workspace }}/.cache/cppcheck

# Cleanup
cd ${{ github.workspace }} && rm -rf temp_dir


- name: Add Cppcheck to Path
if: ${{ inputs.use_cppcheck == "true" }}
shell: bash
run: |
if [ -d "${{ github.workspace }}/.cache/cppcheck/usr/bin" ]; then
echo "${{ github.workspace }}/.cache/cppcheck/usr/bin" >> $GITHUB_PATH
fi
sudo apt-get install -qq -y cppcheck

- name: Set up pre-commit cache
id: cache-pre-commit
if: ${{ inputs.use_cache == "true" }}
if: inputs.use_cache == 'true'
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles(".pre-commit-config.yaml") }}
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-

Expand Down
Loading