1
0
mirror of https://github.com/catchorg/Catch2.git synced 2025-01-16 07:08:01 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Martin Hořeňovský
0fa133a0c5
Run checking scripts directly 2020-11-10 15:25:52 +01:00
Martin Hořeňovský
447b39cae0
Better names for misc-checks workflow steps 2020-11-10 15:25:24 +01:00
Martin Hořeňovský
851a0e907e
Make scripts executable 2020-11-10 15:22:15 +01:00
Martin Hořeňovský
93312b369e
Merge pull request #2099 from innerout/check-license
Adds license check in CI
2020-11-10 11:10:03 +01:00
George Xanthakis
d913837a5d
Adds license check in CI 2020-11-10 00:51:24 +02:00
4 changed files with 39 additions and 7 deletions

View File

@ -1,7 +1,5 @@
name: Check header guards
# Run this workflow every time a new commit pushed to your repository
on: [push, pull_request]
jobs:
@ -20,8 +18,7 @@ jobs:
- name: Install checkguard
run: pip install guardonce
# Check include guard naming convention
- name: checkguard
- name: Check that include guards are properly named
run: |
wrong_files=$(checkguard -r src/catch2/ -p "name | append _INCLUDED | upper")
if [[ $wrong_files ]]; then
@ -30,7 +27,10 @@ jobs:
exit 1
fi
# Check duplicate files for include guard conflicts
- name: checknames
- name: Check that there are no duplicated filenames
run: |
python tools/scripts/checkDuplicateFilenames.py
./tools/scripts/checkDuplicateFilenames.py
- name: Check that all source files have the correct license header
run: |
./tools/scripts/checkLicense.py

0
tools/scripts/checkConvenienceHeaders.py Normal file → Executable file
View File

0
tools/scripts/checkDuplicateFilenames.py Normal file → Executable file
View File

32
tools/scripts/checkLicense.py Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env python3
import os
import sys
def get_license():
with open("src/catch2/catch_all.hpp", "r") as f:
license = f.readlines()[0:7]
return license
def check_license(license):
failed = 0
base_dir = "src/catch2/"
# The _ represents the list of directories in base_dir
for root, _, files in os.walk(base_dir):
for file in files:
with open(root + "/" + file, "r") as f:
file_license = f.readlines()[0:7]
if file_license != license:
print("File %s does not have license" % file)
failed = 1
return failed
license = get_license()
status = check_license(license)
sys.exit(status)