forked from demisto/content
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (64 loc) · 2.01 KB
/
pre-commit.yml
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
name: pre-commit
on: pull_request
jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: Install poetry
uses: Gr1N/setup-poetry@v8
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- name: Install dependencies
run: poetry install
- name: Cache Pre commit
id: cache-pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit
- name: run pre-commit
run: |
npm install
poetry run demisto-sdk pre-commit -g --unit-test --validate --no-secrets --show-diff-on-failure --verbose
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
check_name: Unit Test Report
report_paths: |
**/Packs/**/Integrations/**/.report_pytest.xml
github_token: ${{ secrets.GITHUB_TOKEN }}
detailed_summary: true
annotate_only: true
- name: "Check coverage.xml exists"
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "coverage.xml"
- name: Code Coverage Report
if: steps.check_files.outputs.files_exists == 'true'
uses: irongut/[email protected]
with:
filename: "coverage.xml"
badge: true
format: markdown
output: both
thresholds: '70 80'
- name: Append coverage to summary
if: always()
id: append-coverage
run: |
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY || echo "Missing coverage report"