ci: check if sources include license header

This commit is contained in:
youben11
2021-12-29 15:54:23 +01:00
committed by rudy-6-4
parent 940cb96be4
commit e3ae6e9c06
2 changed files with 32 additions and 0 deletions

View File

@@ -28,6 +28,13 @@ jobs:
- name: Format with clang-format
run: .github/workflows/scripts/format_cpp.sh
CheckLicense:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check if sources include the license header
run: .github/workflows/scripts/check_for_license.sh
BuildAndTest:
runs-on: ubuntu-latest
strategy:

View File

@@ -0,0 +1,25 @@
#!/bin/bash
print_and_exit() {
echo "Need to add license header to file $1"
exit 1
}
files=$(find ./compiler/{include,lib,src} -iregex '^.*\.\(cpp\|cc\|h\|hpp\)$')
for file in $files
do
cmp <(head -n 4 $file) <(echo "// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license
// information.") || print_and_exit $file
done
files=$(find ./compiler/{include,lib,src} -iregex '^.*\.\(py\)$')
for file in $files
do
cmp <(head -n 2 $file) <(echo "# Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions.
# See https://github.com/zama-ai/homomorphizer/blob/master/LICENSE.txt for license information.") || print_and_exit $file
done