11name : 🛡️ Bastion Quality Gates
22
3+
34on :
45 push :
56 branches : [ "main" ]
67 pull_request :
78 branches : [ "main" ]
9+ schedule :
10+ - cron : ' 0 0 * * 0' # Weekly on Sunday
811 workflow_dispatch :
912
1013permissions :
1114 pull-requests : read
1215 security-events : write
1316
1417jobs :
18+ test :
19+ uses : ./.github/workflows/python-tests.yml
20+ # This workflow now depends on the successful completion of the python-tests workflow
1521 Analyze :
22+ needs : test
1623 runs-on : ubuntu-latest
1724 strategy :
1825 matrix :
19- tool : [bandit, ruff, mypy, flake8, pylint, codeql, snyk]
26+ tool : [bandit, ruff, mypy, flake8, pylint, codeql, snyk, pyright, cyclonedx ]
2027 steps :
2128 - name : Checkout code
2229 uses : actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2
5057 poetry install --with dev --no-interaction
5158
5259 - name : Install analysis tools
53- if : matrix.tool != 'codeql' && matrix.tool != 'snyk'
60+ if : matrix.tool != 'codeql' && matrix.tool != 'snyk' && matrix.tool != 'pyright' && matrix.tool != 'cyclonedx'
5461 run : |
5562 poetry run pip install bandit ruff mypy flake8 pylint
5663 poetry run bandit --version
5966 poetry run flake8 --version
6067 poetry run pylint --version
6168
69+ - name : Install Node.js for Pyright
70+ if : matrix.tool == 'pyright'
71+ uses : actions/setup-node@v4
72+ with :
73+ node-version : ' 20'
74+
75+ - name : Install Pyright
76+ if : matrix.tool == 'pyright'
77+ run : |
78+ npm install -g pyright
79+ pyright --version
80+
81+ - name : Install CycloneDX
82+ if : matrix.tool == 'cyclonedx'
83+ run : |
84+ poetry run pip install cyclonedx-bom
85+ poetry run cyclonedx-py --version || echo "CycloneDX installed"
86+
6287 - name : Setup Snyk CLI
6388 if : matrix.tool == 'snyk'
6489 uses : snyk/actions/setup@cdb760004ba9ea4d525f2e043745dfe85bb9077e
7398 run : |
7499 pip install poetry
75100 pip install poetry-plugin-export
76- poetry export --format requirements.txt --output requirements.txt
77- snyk test --file=requirements.txt --sarif-file-output=snyk_report.sarif
101+ poetry export --format requirements.txt --output requirements.txt --with dev
102+ pip install black blake3 click colorama flake8 gmpy2 isort mccabe msgpack-types mypy-extensions pathspec psutil pycodestyle pyflakes setuptools types-requests types-setuptools typing-extensions
103+ snyk test --file=requirements.txt --sarif-file-output=snyk_report.sarif --skip-unresolved || snyk test --file=requirements.txt --sarif-file-output=snyk_report.sarif --skip-unresolved --all-projects
78104
79105 - name : Run Bandit
80106 if : matrix.tool == 'bandit'
@@ -96,6 +122,15 @@ jobs:
96122 if : matrix.tool == 'pylint'
97123 run : poetry run pylint --recursive=y . --output-format=json > pylint_report.json || true
98124
125+ - name : Run Pyright
126+ if : matrix.tool == 'pyright'
127+ run : pyright --outputjson > pyright_report.json || true
128+
129+ - name : Generate Software Bill of Materials (SBOM)
130+ if : matrix.tool == 'cyclonedx'
131+ run : |
132+ poetry run cyclonedx-py -o cyclonedx_report.json -j . || true
133+
99134 - name : Initialize CodeQL
100135 if : matrix.tool == 'codeql'
101136 uses : github/codeql-action/init@main
@@ -137,10 +172,12 @@ jobs:
137172 mv reports/pylint-report/pylint_report.json .
138173 mv reports/codeql-report/codeql_report.sarif .
139174 mv reports/snyk-report/snyk_report.sarif .
175+ mv reports/pyright-report/pyright_report.json .
176+ mv reports/cyclonedx-report/cyclonedx_report.json .
140177
141178 - name : Check if reports exist
142179 run : |
143- for report in bandit_report.json ruff_report.json mypy_report.txt flake8_report.txt pylint_report.json codeql_report.sarif snyk_report.sarif; do
180+ for report in bandit_report.json ruff_report.json mypy_report.txt flake8_report.txt pylint_report.json codeql_report.sarif snyk_report.sarif pyright_report.json cyclonedx_report.json ; do
144181 if [ ! -f "$report" ]; then
145182 echo "$report not found. Exiting."
146183 exit 1
@@ -163,5 +200,7 @@ jobs:
163200 -Dsonar.python.flake8.reportPaths=flake8_report.txt
164201 -Dsonar.python.pylint.reportPaths=pylint_report.json
165202 -Dsonar.sarifReportPaths=codeql_report.sarif,snyk_report.sarif
203+ -Dsonar.externalIssuesReportPaths=pyright_report.json
204+ -Dsonar.dependencyCheck.jsonReportPath=cyclonedx_report.json
166205 -Dsonar.python.version=3.10-3.13
167206 -Dsonar.languages=python
0 commit comments