-
Notifications
You must be signed in to change notification settings - Fork 2
155 lines (137 loc) · 4.92 KB
/
Copy pathcode_checks.yml
File metadata and controls
155 lines (137 loc) · 4.92 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# =========================================================
# GitHub Actions Workflow: Code Quality Checks
# =========================================================
name: Code Quality Checks
on:
workflow_call:
inputs:
project-yaml:
required: true
type: string
description: 'Project Yaml file that consists of build and check configurations'
user-yaml:
required: true
type: string
description: 'User Yaml file with list of build and checks to be executed'
defaults:
run:
shell: bash
# =========================================================
# Job: setup
# - Prepares the code check matrix
# =========================================================
jobs:
setup:
runs-on: ubuntu-24.04
container:
image: docker.io/ifxmakers/makers-docker:latest
volumes:
- .:/myLocalWorkingDir:rw
options: --cpus 1
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v4
with:
submodules: true
- name: Set strategy matrix (get all code checks)
id: set-matrix
run: |
eval $(python3 extras/makers-devops/src/python/code_checks/codeChecks.py --projectYAML "${{ inputs.project-yaml }}" --userYAML "${{ inputs.user-yaml }}" --getAllCodeChecks)
- name: Append Code Checks Output to Summary
run: |
echo "## 📜 Code Quality Report" >> $GITHUB_STEP_SUMMARY
outputs:
checks: ${{ steps.set-matrix.outputs.checks }}
# =========================================================
# Job: codeChecks
# - Runs all code checks in parallel (matrix)
# =========================================================
codeChecks:
runs-on: ubuntu-24.04
needs: setup
container:
image: docker.io/ifxmakers/makers-docker:latest
volumes:
- .:/myLocalWorkingDir:rw
options: --cpus 1
strategy:
fail-fast: false
matrix:
checks: ${{ fromJson(needs.setup.outputs.checks) }}
steps:
- name: Checkout repository (recursive submodules)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-tags: true
fetch-depth: 0
- name: Run code check (${{ matrix.checks }})
id: run_build
run: |
echo "Workflow has these parameters :"
echo "matrix.checks : ${{ matrix.checks }}"
echo ""
python3 extras/makers-devops/src/python/code_checks/codeChecks.py --projectYAML "${{ inputs.project-yaml }}" --userYAML "${{ inputs.user-yaml }}" --runCheck ${{ matrix.checks }} > output.log
- name: Archive code check reports
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.checks }}
path: _results
- name: Append Code Checks Output to Summary
if: success() || failure()
run: |
echo "<details>" >> $GITHUB_STEP_SUMMARY
cat output.log >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
# =========================================================
# Job: GenerateAndUploadReports
# - Collects, generates, and uploads HTML reports
# - Deploys to GitHub Pages
# =========================================================
GenerateAndUploadReports:
runs-on: ubuntu-24.04
if: success() || failure()
needs: codeChecks
container:
image: docker.io/ifxmakers/makers-docker:latest
volumes:
- .:/myLocalWorkingDir:rw
options: --cpus 1
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v4
with:
submodules: true
- name: Download all code check artifacts
uses: actions/download-artifact@v4
with:
path: _results
- name: Normalize tool result directories
run: |
for d in _results/*/*/; do
tool=$(basename "$d")
mkdir -p "_results/$tool"
shopt -s dotglob nullglob
mv "$d"* "_results/$tool/" || true
done
- name: Generate HTML Reports
run: |
extras/makers-devops/src/python/code_checks/run_generate_reports.sh --results-dir _results
- name: Upload HTML report as artifact
uses: actions/upload-artifact@v4
with:
name: html-report
path: _results/html-reports
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _results/html-reports/source-code-quality
keep_files: false
- name: Display Report URL in Workflow Summary
run: |
REPORT_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"
echo "**Code Quality Report Published**" >> $GITHUB_STEP_SUMMARY
echo "[View Report Here]($REPORT_URL)" >> $GITHUB_STEP_SUMMARY
echo "URL: $REPORT_URL"