From 59e3d4fd3a433765486a1d7b6e70917846c5130b Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Thu, 23 May 2024 09:26:34 -0400 Subject: [PATCH] Use latest clang-tidy for style checks. --- .github/workflows/style_check.yaml | 48 ++++++++++++++++++++++++++++++ .github/workflows/style_check.yml | 42 -------------------------- 2 files changed, 48 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/style_check.yaml delete mode 100644 .github/workflows/style_check.yml diff --git a/.github/workflows/style_check.yaml b/.github/workflows/style_check.yaml new file mode 100644 index 00000000..3cfb56fe --- /dev/null +++ b/.github/workflows/style_check.yaml @@ -0,0 +1,48 @@ +name: Style check + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + pull_request: + + push: + branches: + - "trunk-*" + + workflow_dispatch: + +env: + UV_VERSION: 0.2.2 + +jobs: + clang-tidy: + name: Run clang-tidy + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4.1.6 + - name: Set up Python + uses: actions/setup-python@v5.1.0 + with: + python-version: 3.12 + - name: Install uv + run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash + - name: Install prereqs + run: 'uv pip install -r .github/requirements-test.txt --only-binary :all: --system --reinstall' + - name: Configure + run: cmake -B build + - name: Execute clang-tidy + run: clang-tidy-18 -p=build gsd/*.c gsd/*.h scripts/*.cc --quiet --warnings-as-errors="*" + + # This job is used to provide a single requirement for branch merge conditions. + checks_complete: + name: Style check + if: always() + needs: [clang-tidy] + runs-on: ubuntu-latest + + steps: + - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' + - name: Done + run: exit 0 diff --git a/.github/workflows/style_check.yml b/.github/workflows/style_check.yml deleted file mode 100644 index 9976cb4f..00000000 --- a/.github/workflows/style_check.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Style check - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: - # Trigger on pull requests. - pull_request: - - # Trigger on pushes to the mainline branches and version tags. This prevents building commits - # twice when the pull request source branch is in the same repository. - push: - branches: - - "trunk-patch" - - "trunk-minor" - - "trunk-major" - - # Trigger on request. - workflow_dispatch: - -jobs: - clang-tidy: - name: Run clang-tidy - runs-on: ubuntu-latest - container: - image: glotzerlab/ci:2023.10.09-clang14_py311 - steps: - - uses: actions/checkout@v4.1.4 - - name: Configure - run: cmake -B build - - name: Execute clang-tidy - run: clang-tidy -p=build gsd/*.c gsd/*.h scripts/*.cc --quiet --warnings-as-errors="*" - - # This job is used to provide a single requirement for branch merge conditions. - checks_complete: - name: Style check - needs: [clang-tidy] - runs-on: ubuntu-latest - - steps: - - run: echo "Done!"