Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
BasedOnStyle: Google
25 changes: 25 additions & 0 deletions .github/format-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# formatting using the ldmx/dev image which has clang-format in it

set -o errexit
set -o nounset

if [ -z "${GITHUB_WORKSPACE+x}" ]; then
# we are not in github actions so we need to error out
echo "ERROR: this script expects to be run in GitHub actions so should not be run locally."
exit 1
fi

ldmx() {
docker \
run \
--rm \
--volume ${GITHUB_WORKSPACE} \
--env LDMX_BASE=${GITHUB_WORKSPACE} \
ldmx/dev:latest \
${PWD}
$@
}
find include/ -type f > ${TMPDIR:-/tmp}/files-to-format.list
find src/ -type f >> ${TMPDIR:-/tmp}/files-to-format.list
ldmx clang-format --verbose -Werror --dry-run $(cat ${TMPDIR:-/tmp}/files-to-format.list)
14 changes: 14 additions & 0 deletions .github/workflows/format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check Format
on:
push:
branches:
- 'trunk'
pull_request:

jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: run format check
run: ./.github/format-check