Updated readme #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'information' | |
type: choice | |
options: | |
- information | |
- debug | |
- warning | |
- critical | |
tags: | |
description: 'Purpose of Run This Workflow?' | |
required: true | |
type: string | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repository | |
- uses: actions/checkout@v4 | |
# Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' # Specify the Python version (e.g., 3.8, 3.9, etc.) | |
- name: Run Bandit Security Scan | |
run: | | |
pip install bandit | |
bandit ./app -r -x ./app/tests/ | |
# - name: Run Semgrep | |
# run: | | |
# pip install semgrep | |
# semgrep --config p/ci ./app | |
# - name: Run Safety Security Check | |
# run: | | |
# pip install safety | |
# safety check --full-report | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest black # Add your project's dependencies as well | |
pip install --no-cache-dir --upgrade -r requirements.txt | |
# Lint with Flake8 | |
- name: Lint with flake8 | |
continue-on-error: true # Continue even if this step fails | |
run: | | |
flake8 --ignore=E302 --verbose ./app # Lints the code in the current directory | |
# Run tests with pytest | |
- name: Test with pytest | |
continue-on-error: true # Continue even if this step fails | |
run: | | |
pytest ./app # Runs all the tests in the project | |
# Format code with Black (optional) | |
- name: Check code formatting with Black | |
continue-on-error: true # Continue even if this step fails | |
run: | | |
black --check ./app # Checks if the code is formatted according to Black | |
# Build the Docker image (only runs if the previous steps pass) | |
- name: Build the Docker image | |
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) |