-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9b34f1
commit 3db21f4
Showing
4 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
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
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
28 changes: 28 additions & 0 deletions
28
frontends/concrete-python/scripts/actionlint/actionlint.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
LOG_FILE=$(mktemp /tmp/actionlint.script.XXXXXX) | ||
SUMMARY_LOG_FILE=$(mktemp /tmp/actionlint.script.XXXXXX) | ||
|
||
# Get actionlint errors | ||
actionlint | cat > "$LOG_FILE" | ||
|
||
# Get only where the errors are, not their type | ||
grep -v .yml "$LOG_FILE" | grep -v ^" |" | cat > "$SUMMARY_LOG_FILE" | ||
|
||
# Check errors which are not whitelisted | ||
if python3 scripts/actionlint/actionlint_check_with_whitelists.py < "$SUMMARY_LOG_FILE"; | ||
then | ||
echo "Successful end" | ||
exit 0 | ||
else | ||
echo "Full log file: " | ||
cat "$LOG_FILE" | ||
|
||
echo | ||
echo "Summary log file:" | ||
cat "$SUMMARY_LOG_FILE" | ||
exit 255 | ||
fi | ||
|
44 changes: 44 additions & 0 deletions
44
frontends/concrete-python/scripts/actionlint/actionlint_check_with_whitelists.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" Check an actionlint log against some whitelists """ | ||
|
||
import sys | ||
from typing import Set | ||
|
||
# Exact lines which are whitelisted | ||
whitelisted_lines: Set[str] = set() | ||
|
||
# Pattern which are whitelisted | ||
whitelisted_pattern: Set[str] = { | ||
} | ||
|
||
|
||
def main(): | ||
"""Do the test | ||
Raises: | ||
ValueError: if non whitelisted error occurred | ||
""" | ||
status = 0 | ||
bad_lines = [] | ||
for line in sys.stdin: | ||
if line in whitelisted_lines: | ||
continue | ||
|
||
is_bad_line = True | ||
|
||
for pattern in whitelisted_pattern: | ||
if pattern in line: | ||
is_bad_line = False | ||
break | ||
|
||
if is_bad_line: | ||
print("->", line) | ||
status = 1 | ||
bad_lines.append(line) | ||
|
||
if status: | ||
errors = "\n------\n".join(bad_lines) | ||
raise ValueError("Some non whitelisted errors, look at full log file:" f"{errors}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |