This repository was archived by the owner on Jun 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (70 loc) · 2.57 KB
/
main_workflow.yml
File metadata and controls
81 lines (70 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Main_Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
EXECUTABLES: "42sh"
jobs:
check_coding_style:
runs-on: ubuntu-latest
container: ghcr.io/epitech/coding-style-checker:latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run coding style checker
run: |
check.sh $(pwd) $(pwd)
while IFS= read -r line; do
file=$(echo "$line" | awk -F ':' '{print $1}')
line_number=$(echo "$line" | awk -F ':' '{print $2}')
severity=$(echo "$line" | awk -F ':' '{print $3}')
message=$(echo "$line" | awk -F ':' '{print $4}')
echo "::error file=$file,line=$line_number::$severity $message"
done < coding-style-reports.log
line_count=$(wc -l coding-style-reports.log | awk '{print $1}')
if [ "$line_count" -gt 6 ]; then
echo "::error::Too many style errors"
exit 1
fi
compile_and_run_tests:
needs: check_coding_style
runs-on: ubuntu-latest
container: epitechcontent/epitest-docker
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Compile program
run: make
- name: Check executables
run: |
IFS=',' read -ra exec_paths <<< "${EXECUTABLES}"
for exec_path in "${exec_paths[@]}"; do
[ -x "$exec_path" ] || exit 1
done
- name: Run program_tester
run: |
echo "## Binary Testing" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
make binary_tests_run >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Clean
run: make fclean
- name: Run tests and generate coverage reports
run: |
echo "## Unit Tests" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
make tests_run 2>> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "## Coverage" >> $GITHUB_STEP_SUMMARY
echo "### Lines" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
gcovr --txt --exclude tests/ --exclude src/main.c >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "### Branches" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
gcovr --txt --exclude tests/ --exclude src/main.c --branches >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY