Skip to content

Commit ecfd94a

Browse files
authored
fix(codecov): create components (#6028)
1 parent eddc672 commit ecfd94a

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

.github/workflows/api-pull-request.yml

+15
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ jobs:
6969
7070
steps:
7171
- uses: actions/checkout@v4
72+
7273
- name: Test if changes are in not ignored paths
7374
id: are-non-ignored-files-changed
7475
uses: tj-actions/changed-files@v45
@@ -80,18 +81,21 @@ jobs:
8081
api/permissions/**
8182
api/README.md
8283
api/mkdocs.yml
84+
8385
- name: Install poetry
8486
working-directory: ./api
8587
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
8688
run: |
8789
python -m pip install --upgrade pip
8890
pipx install poetry
91+
8992
- name: Set up Python ${{ matrix.python-version }}
9093
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
9194
uses: actions/setup-python@v5
9295
with:
9396
python-version: ${{ matrix.python-version }}
9497
cache: "poetry"
98+
9599
- name: Install dependencies
96100
working-directory: ./api
97101
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
@@ -109,48 +113,59 @@ jobs:
109113
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
110114
run: |
111115
poetry lock --check
116+
112117
- name: Lint with ruff
113118
working-directory: ./api
114119
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
115120
run: |
116121
poetry run ruff check . --exclude contrib
122+
117123
- name: Check Format with ruff
118124
working-directory: ./api
119125
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
120126
run: |
121127
poetry run ruff format --check . --exclude contrib
128+
122129
- name: Lint with pylint
123130
working-directory: ./api
124131
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
125132
run: |
126133
poetry run pylint --disable=W,C,R,E -j 0 -rn -sn src/
134+
127135
- name: Bandit
128136
working-directory: ./api
129137
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
130138
run: |
131139
poetry run bandit -q -lll -x '*_test.py,./contrib/' -r .
140+
132141
- name: Safety
133142
working-directory: ./api
134143
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
135144
run: |
136145
poetry run safety check --ignore 70612,66963
146+
137147
- name: Vulture
138148
working-directory: ./api
139149
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
140150
run: |
141151
poetry run vulture --exclude "contrib,tests,conftest.py" --min-confidence 100 .
152+
142153
- name: Hadolint
143154
working-directory: ./api
144155
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
145156
run: |
146157
/tmp/hadolint Dockerfile --ignore=DL3013
158+
147159
- name: Test with pytest
148160
working-directory: ./api
149161
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
150162
run: |
151163
poetry run pytest --cov=./src/backend --cov-report=xml src/backend
164+
152165
- name: Upload coverage reports to Codecov
153166
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
154167
uses: codecov/codecov-action@v5
155168
env:
156169
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
170+
with:
171+
flags: api

.github/workflows/pull-request.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Pull Request"
1+
name: "Pull Request"
22

33
on:
44
push:
@@ -22,6 +22,7 @@ jobs:
2222

2323
steps:
2424
- uses: actions/checkout@v4
25+
2526
- name: Test if changes are in not ignored paths
2627
id: are-non-ignored-files-changed
2728
uses: tj-actions/changed-files@v45
@@ -36,17 +37,20 @@ jobs:
3637
README.md
3738
mkdocs.yml
3839
.backportrc.json
40+
3941
- name: Install poetry
4042
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
4143
run: |
4244
python -m pip install --upgrade pip
4345
pipx install poetry
46+
4447
- name: Set up Python ${{ matrix.python-version }}
4548
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
4649
uses: actions/setup-python@v5
4750
with:
4851
python-version: ${{ matrix.python-version }}
4952
cache: "poetry"
53+
5054
- name: Install dependencies
5155
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
5256
run: |
@@ -57,44 +61,56 @@ jobs:
5761
sed -E 's/.*"v([^"]+)".*/\1/' \
5862
) && curl -L -o /tmp/hadolint "https://github.com/hadolint/hadolint/releases/download/v${VERSION}/hadolint-Linux-x86_64" \
5963
&& chmod +x /tmp/hadolint
64+
6065
- name: Poetry check
6166
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
6267
run: |
6368
poetry lock --check
69+
6470
- name: Lint with flake8
6571
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
6672
run: |
6773
poetry run flake8 . --ignore=E266,W503,E203,E501,W605,E128 --exclude contrib,ui,api
74+
6875
- name: Checking format with black
6976
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
7077
run: |
7178
poetry run black --exclude api ui --check .
79+
7280
- name: Lint with pylint
7381
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
7482
run: |
7583
poetry run pylint --disable=W,C,R,E -j 0 -rn -sn prowler/
84+
7685
- name: Bandit
7786
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
7887
run: |
7988
poetry run bandit -q -lll -x '*_test.py,./contrib/,./api/,./ui' -r .
89+
8090
- name: Safety
8191
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
8292
run: |
8393
poetry run safety check --ignore 70612 -r pyproject.toml
94+
8495
- name: Vulture
8596
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
8697
run: |
8798
poetry run vulture --exclude "contrib,api,ui" --min-confidence 100 .
99+
88100
- name: Hadolint
89101
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
90102
run: |
91103
/tmp/hadolint Dockerfile --ignore=DL3013
104+
92105
- name: Test with pytest
93106
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
94107
run: |
95108
poetry run pytest -n auto --cov=./prowler --cov-report=xml tests
109+
96110
- name: Upload coverage reports to Codecov
97111
if: steps.are-non-ignored-files-changed.outputs.any_changed == 'true'
98112
uses: codecov/codecov-action@v5
99113
env:
100114
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
115+
with:
116+
flags: prowler

codecov.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
component_management:
2+
individual_components:
3+
- component_id: "prowler"
4+
paths:
5+
- "prowler/**"
6+
- component_id: "api"
7+
paths:
8+
- "api/**"
9+
10+
comment:
11+
layout: "header, diff, flags, components"

0 commit comments

Comments
 (0)