-
Notifications
You must be signed in to change notification settings - Fork 977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Github Actions : Added Mypy and Python Bandit Security automation #1284
base: main
Are you sure you want to change the base?
Changes from all commits
440e92f
a311e33
7720086
02ba6ab
1673794
151a82d
1940928
f16e32d
5ba68c4
f085582
d6d5a69
969b2f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Security check - Bandit # Name of the GitHub Actions workflow | ||
|
||
on: [push, pull_request] # Trigger the workflow | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest # Executes the job on the latest version of Ubuntu | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. point to a ubuntu version (preferably 22.04), not pinning a version might introduce regression in future |
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] # Running matrix jobs on both Ubuntu and macOS | ||
name: Python ${{ matrix.os }} # Name the job based on the OS being used | ||
|
||
steps: | ||
- uses: actions/checkout@v2 # Checks out your repository's code | ||
|
||
- name: Security check - Bandit # Run Bandit security check | ||
uses: ioggstream/[email protected] # Using Bandit for security checks | ||
with: | ||
project_path: . # Path to the project to scan | ||
ignore_failure: true # Continue the workflow even if Bandit reports issues | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we obviously dont want to ignore errors and failures. we want the checks to fail on encountering such errors |
||
|
||
# This step is optional, it uploads the Bandit report as an artifact | ||
- name: Security check report artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: Security report # Name of the artifact | ||
path: output/security_report.txt # Path to the Bandit security report |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: "mypy check" # Name of the GitHub Actions workflow | ||
|
||
on: [push, pull_request] # Trigger the workflow | ||
|
||
jobs: | ||
|
||
static-type-check: | ||
runs-on: ubuntu-latest # Executes the job on the latest version of Ubuntu | ||
|
||
steps: | ||
- uses: actions/checkout@v2 # Checks out your repository's code | ||
- uses: actions/setup-python@v3 # Sets up Python for the job | ||
with: | ||
python-version: '3.x' # Specifies Python version 3.x | ||
|
||
- run: pip install mypy # Installs mypy for static type checking, you can specify a version here | ||
|
||
- name: Get Python changed files # Identifies changed Python files | ||
id: changed-py-files | ||
uses: tj-actions/changed-files@v23 | ||
with: | ||
files: | | ||
*.py | ||
**/*.py | ||
|
||
- name: Run if any of the listed files above is changed # Runs mypy on changed files | ||
if: steps.changed-py-files.outputs.any_changed == 'true' # Conditional execution if any Python files changed | ||
run: mypy ${{ steps.changed-py-files.outputs.all_changed_files }} --ignore-missing-imports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are you thinking we should run the actions on both the time we "push" changes and open "pull requests".