-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit dd4d3b3
Showing
604 changed files
with
112,951 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Disable statistics for generated documentation | ||
docs/html/* linguist-detectable=false | ||
docs/html/search/* linguist-detectable=false | ||
docs/tests/* linguist-detectable=false | ||
|
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,110 @@ | ||
#!/bin/bash | ||
|
||
# Executables | ||
executables="corewar" | ||
|
||
# Couleur pour les messages | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
RESET='\033[0m' | ||
BOLD='\033[1m' | ||
|
||
# Fonction pour compter les occurrences d'un mot dans un fichier | ||
count_occurrences() { | ||
local word=$1 | ||
local file=$2 | ||
grep -o -i -w "$word" "$file" | wc -l | ||
} | ||
|
||
# Nom du fichier de résultat | ||
file="plum_result.txt" | ||
|
||
# Exécution du coding style checker | ||
plum > $file | ||
|
||
# Compter les occurrences de MAJOR, MINOR et INFO | ||
major_count=$(count_occurrences "MAJOR" "$file") | ||
minor_count=$(count_occurrences "MINOR" "$file") | ||
info_count=$(count_occurrences "INFO" "$file") | ||
|
||
# Vérifier si le fichier contient plus de 2 occurrences de MAJOR, MINOR ou INFO | ||
if [ $major_count -gt 2 ] || [ $minor_count -gt 2 ] || [ $info_count -gt 2 ]; then | ||
cat $file | ||
echo -e "${RED}${BOLD}${BOLD}INTERDICTION DE PUSH:${RED}${RED} Le fichier contient des erreurs de Coding-Style !$RESET" | ||
rm -rf $file | ||
exit 1 | ||
else | ||
echo -e "${GREEN}Aucune erreur de Coding-Style détecter.${RESET}" | ||
fi | ||
|
||
# Supprimer le fichier de résultat | ||
rm -rf $file | ||
|
||
# Tester la compilation | ||
make >/dev/null 2>&1 & | ||
pid=$! | ||
wait $pid | ||
if [ $? -ne 0 ]; then | ||
echo -e "${RED}${BOLD}INTERDICTION DE PUSH:${RED} La compilation a échouée.${RESET}" | ||
exit 1 | ||
else | ||
echo -e "${GREEN}La compilation s'est déroulée correctement.${RESET}" | ||
fi | ||
|
||
# Tester | ||
make clean >/dev/null 2>&1 & | ||
pid=$! | ||
wait $pid | ||
|
||
# Check la création de l'exécutable | ||
.github/workflows/check_program_compilation $executables >/dev/null 2>&1 & | ||
pid=$! | ||
wait $pid | ||
if [ $? -ne 0 ]; then | ||
echo -e "${RED}${BOLD}INTERDICTION DE PUSH:${RED} Les executables n'ont pas été trouvé.${RESET}" | ||
exit 1 | ||
else | ||
echo -e "${GREEN}Les executables ont bien été trouvé.${RESET}" | ||
fi | ||
|
||
# Check les fonctions autorisées | ||
.github/workflows/check_banned_functions $executables .github/workflows/authorized_functions.txt > result.txt | ||
pid=$! | ||
wait $pid | ||
if [ $? -ne 0 ]; then | ||
cat result.txt | ||
echo -e "${RED}${BOLD}INTERDICTION DE PUSH:${RED} Des fonctions bannies ont été trouvé.${RESET}" | ||
rm -rf result.txt | ||
exit 1 | ||
else | ||
echo -e "${GREEN}Aucune fonction bannie n'a été trouvé.${RESET}" | ||
fi | ||
rm -rf result.txt | ||
|
||
# Tester les unit tests | ||
make tests_run >/dev/null 2>&1 & | ||
pid=$! | ||
wait $pid | ||
if [ $? -ne 0 ]; then | ||
echo -e "${RED}${BOLD}INTERDICTION DE PUSH:${RED} Les tests unitaires ont échoués.${RESET}" | ||
exit 1 | ||
else | ||
echo -e "${GREEN}Les tests unitaires se sont déroulés correctement.${RESET}" | ||
fi | ||
|
||
# Vérifier la taille du repository | ||
make fclean >/dev/null 2>&1 & | ||
pid=$! | ||
wait $pid | ||
size=$(du -sm --exclude='.git' | cut -f1) | ||
limit=30 | ||
if [ "$size" -gt "$limit" ]; then | ||
echo -e "${RED}${BOLD}INTERDICTION DE PUSH:${RED} La taille du repository dépasse la limite autorisée ($size MB > $limit MB)${RESET}" | ||
exit 1 | ||
else | ||
echo -e "${GREEN}La taille du repository est inférieure à la limite autorisée ($size MB < $limit MB)${RESET}" | ||
fi | ||
|
||
# Push | ||
echo -e "${GREEN}${BOLD}PUSH AUTORISÉ !${RESET}" | ||
git push |
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,52 @@ | ||
name: my_rpg | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
EXECUTABLE: my_rpg | ||
|
||
jobs: | ||
check_coding_style: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ghcr.io/epitech/coding-style-checker:latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.1.1 | ||
- name: Launch coding style checker | ||
run: check.sh $(pwd) $(pwd) | ||
- name: Check coding style | ||
run: | ||
cat coding-style-reports.log; | ||
.github/workflows/display_coding_style | ||
|
||
check_program: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: epitechcontent/epitest-docker | ||
needs: check_coding_style | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4.1.1 | ||
- name: Launch "make" | ||
run: make | ||
timeout-minutes: 2 | ||
- name: Launch "make clean" | ||
run: make clean | ||
- name: Check program compilation | ||
run: .github/workflows/check_program_compilation ${{ env.EXECUTABLE }} | ||
- name: Launch "make tests_run" | ||
run: make tests_run | ||
timeout-minutes: 2 | ||
- name: Check repository size | ||
run: | | ||
make fclean | ||
size=$(du -sm --exclude='.git' | cut -f1) | ||
limit=30 | ||
if [ "$size" -gt "$limit" ]; then | ||
echo "::error title=Repository size::Repository size is too big ($size MB > $limit MB)" | ||
exit 1 | ||
else | ||
echo "::notice title=Repository size::Repository size is correct ($size MB <= $limit MB)" | ||
exit 0 | ||
fi |
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,19 @@ | ||
#!/bin/python3 | ||
import os | ||
from sys import argv | ||
|
||
if __name__ == "__main__": | ||
if len(argv) == 2: | ||
file_content = argv[1].split(",") | ||
for file in file_content: | ||
if not os.path.exists(file): | ||
print("::error file=" + file + "::File not found") | ||
exit(1) | ||
if not os.access(file, os.X_OK): | ||
print("::error file=" + file + "::File is not executable") | ||
exit(1) | ||
print("::notice title=Program compilation::All programs was compiled successfully") | ||
exit(0) | ||
else: | ||
print("::notice title=Program compilation::All programs was compiled successfully") | ||
exit(0) |
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,22 @@ | ||
#!/bin/python3 | ||
|
||
if __name__ == "__main__": | ||
with open("coding-style-reports.log", "r") as f: | ||
file_content = f.readlines() | ||
find = False | ||
if len(file_content) > 0: | ||
for line in file_content: | ||
content = line.split(":") | ||
if len(content[2].split(" ")) > 2: | ||
continue | ||
print("::error file=" + content[0] + ",line=" + content[1] + | ||
",title=" + content[2].split(" ")[1] + " coding style error::" + content[3]) | ||
find = True | ||
if find: | ||
exit(1) | ||
else: | ||
print("::notice title=Coding Style::No errors found") | ||
exit(0) | ||
else: | ||
print("::notice title=Coding Style::No errors found") | ||
exit(0) |
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,24 @@ | ||
*.log* | ||
/temp | ||
*~ | ||
#*# | ||
*.a | ||
a.out | ||
*.gcda | ||
*.gcno | ||
*.gcov | ||
vgcore.* | ||
.#* | ||
*.o | ||
foo.txt | ||
*.old | ||
unit_tests | ||
.idea/ | ||
*.psd | ||
.vscode/ | ||
maps/ | ||
exec | ||
banana_reports | ||
my_rpg | ||
test.png | ||
save/* |
Binary file not shown.
Oops, something went wrong.