-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 1.74 KB
/
ci.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
name: Formatting and security checks
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Check secrets
- name: Detecting secrets
run: |
pip install detect-secrets
detect-secrets scan --all-files
# Check for Terraform and IaC
- name: Terraform and Infrastruce as Code Checks
run: |
wget https://github.com/tfsec/tfsec/releases/download/v0.58.9/tfsec-linux-amd64
chmod +x tfsec-linux-amd64
sudo mv tfsec-linux-amd64 /usr/local/bin/tfsec
pip install checkov
tfsec --force-all-dirs .
checkov -d .
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
cache: "pip"
# Install Python dependencies
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install black isort bandit safety
- name: Check formatting with Black
run: black --check .
- name: Check imports with isort
run: isort --check-only .
- name: Run bandit for vulnerabilities
run: |
bandit --recursive . --exit-zero
- name: Run safety for security checks for packages
run: |
safety check -r requirements.txt
safety check
# Install Node.js for Prettier on HTML, CSS, and JavaScript
- name: Set up Node.js for formatting & linting
uses: actions/setup-node@v3
with:
node-version: '14' # Use Node.js 14.x
- name: Check formatting with Prettier
run: |
npm install --save-dev --save-exact prettier
npx prettier --check "**/*.{html,css,js}"