-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (74 loc) · 2.37 KB
/
code_checker.yml
File metadata and controls
95 lines (74 loc) · 2.37 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI Pull Request Checker
on:
pull_request:
workflow_dispatch:
workflow_call:
jobs:
check_coding_style:
name: Coding Style
runs-on: ubuntu-latest
container:
image: ghcr.io/epitech/coding-style-checker:latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Lunch conding-style
id: coding_style
run: |
echo 'coding_style<<EOF' >> $GITHUB_OUTPUT
check.sh $(pwd) $(pwd);cat coding-style-reports.log >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Add errors
if: ${{ steps.coding_style.outputs.coding_style != '' }}
run: |
while read -r line
do error_type=$(echo $line | cut -d ':' -f 3 | cut -c 2-)
code=$(echo $line | cut -d ':' -f 4)
filename=$(echo $line | cut -d ':' -f 1)
line_number=$(echo $line | cut -d ':' -f 2)
echo "::error title=$error_type coding style error,file=$filename,line=$line_number::$code"
done < coding-style-reports.log
exit 1
project_tests:
name: Project tests
needs: [ check_coding_style ]
if: needs.check_coding_style.result == 'success'
strategy:
matrix:
type: ['criterion', 'ftest', 'custom']
runs-on: ubuntu-latest
container:
image: epitechcontent/epitest-docker:latest
continue-on-error: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run ${{ matrix.type }}
run: make ${{ matrix.type }}
coverage:
name: Coverage
needs: [ project_tests ]
if: needs.project_tests.result == 'success'
runs-on: ubuntu-latest
container:
image: epitechcontent/epitest-docker:latest
outputs:
coverage_line: ${{ steps.coverage_line.outputs.coverage }}
coverage_branch: ${{ steps.coverage_branch.outputs.coverage }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run tests
run: make tests_run
- name: Get lines coverage
id: coverage_line
run: |
echo 'coverage<<EOF' >> $GITHUB_OUTPUT
gcovr --exclude tests/ >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Get branches coverage
id: coverage_branch
run: |
echo 'coverage_branch<<EOF' >> $GITHUB_OUTPUT
gcovr --exclude tests/ --branches >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT