Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: clang-format compliance | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
clang_format_check: | |
runs-on: ubuntu-22.04 | |
steps: | |
# - run: sudo apt-get -yqq update && sudo apt-get -yqq install --no-install-recommends gnupg2 software-properties-common wget | |
# - run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
# - run: sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main' | |
# - run: sudo apt-get -yqq update && sudo apt-get -yqq install clang-format-17 | |
- name: Checkout Spack | |
uses: actions/checkout@v4 | |
with: | |
repository: spack/spack | |
ref: v0.21.0 | |
path: spack | |
- name: Setup Spack | |
run: echo "$PWD/spack/bin" >> "$GITHUB_PATH" | |
- name: Setup Spack Binary Cache | |
run: | | |
spack mirror add v0.21.0 https://binaries.spack.io/v0.21.0 | |
spack mirror add --oci-username ${{ github.actor }} --oci-password ${{ secrets.OCI_TOKEN }} sundials_spack_cache oci://ghcr.io/LLNL/sundials_spack_cache | |
spack buildcache keys --install --trust | |
- name: Install [email protected] dependencies | |
run: spack install --only dependencies [email protected] | |
- name: Push to buildcache | |
if: ${{ !cancelled() }} | |
run: spack buildcache push sundials_spack_cache llvm | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Run checker on code | |
run: | | |
clang-formtat --version | |
find ${{ github.workspace }} \ | |
-name fmod -prune -iname *.h -o -iname *.hpp \ | |
-o -iname *.c -o -iname *.cpp -o -iname *.cuh -o -iname *.cu \ | |
| xargs clang-format -i | |
- name: Run git diff to see if anything changed | |
run: git diff --name-only --exit-code | |
- name: Run git diff if we failed | |
if: failure() | |
run: git diff > diff | |
- name: Archive diff if we failed | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: diff | |
path: | | |
${{ github.workspace }}/diff |