diff --git a/.github/workflows/cpp-standard.yml b/.github/workflows/cpp-standard.yml new file mode 100644 index 0000000..11a1a36 --- /dev/null +++ b/.github/workflows/cpp-standard.yml @@ -0,0 +1,19 @@ +name: PCDS CPP Standard Tests + +on: + workflow_call: + inputs: + project-root: + required: false + type: string + default: "." + description: "The root directory of the CPP project" + +jobs: + pre-commit: + name: "pre-commit checks" + uses: ./.github/workflows/pre-commit.yml + secrets: inherit + with: + args: "--all-files" + system-packages: "cppcheck" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 12ab8fc..3b64614 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -16,6 +16,11 @@ on: description: "Use the problem matcher to annotate the PR diff" required: false type: boolean + system-packages: + default: "" + description: "Space-separated list of system packages to install before running pre-commit" + required: false + type: string jobs: pre-commit: @@ -25,6 +30,7 @@ jobs: - uses: actions/checkout@v4 with: token: ${{ secrets.CHECKOUT_TOKEN || github.token }} + - name: Configure the matcher to annotate the diff if: ${{ inputs.annotate }} run: | @@ -65,6 +71,12 @@ jobs: EOF echo "::add-matcher::$HOME/flake8_problem_matcher.json" + - name: Install required system packages + if: inputs.system-packages != '' + run: | + sudo apt-get update + sudo apt-get -y install ${{ inputs.system-packages }} + - name: Install pre-commit run: | python -m pip install pre-commit