-
Notifications
You must be signed in to change notification settings - Fork 129
50 lines (40 loc) · 1.78 KB
/
clang-format-compliance.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: clang-format compliance
on:
push:
pull_request:
workflow_dispatch:
jobs:
clang_format_check:
runs-on: ubuntu-latest
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
- name: Setup Spack
run: echo "$PWD/spack/bin" >> "$GITHUB_PATH"
- name: Setup Spack Binary Cache
run: spack mirror add --oci-username ${{ github.actor }} --oci-password ${{ secrets.OCI_TOKEN }} sundials_spack_cache oci://ghcr.io/LLNL/sundials_spack_cache
- name: Spack install [email protected]
run: spack install [email protected] && spack buildache push sundials_spack_cache llvm
- name: Check out repository code
uses: actions/checkout@v4
- name: Run checker on code
run: 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