Added CI pipeline #15
Workflow file for this run
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: CI Pipeline | |
permissions: | |
contents: read | |
pull-requests: write | |
checks: write | |
actions: read | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build-verification: | |
name: Build Verification | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.5.0 | |
- name: Ensure local backend | |
run: | | |
echo 'terraform { | |
backend "local" { | |
path = "terraform.tfstate" | |
} | |
}' > infrastructure/backend.tf | |
- name: Terraform Init | |
run: terraform init | |
working-directory: infrastructure | |
- name: Terraform Validate | |
run: terraform validate | |
working-directory: infrastructure | |
static-code-analysis: | |
name: Static Code Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.5.0 | |
- name: Check Terraform Format | |
run: terraform fmt -check | |
working-directory: infrastructure | |
- name: Run Terraform Lint | |
uses: terraform-linters/setup-tflint@v1 | |
with: | |
tflint_version: latest | |
- run: tflint | |
- name: Checkov scan | |
uses: bridgecrewio/checkov-action@v12 | |
with: | |
directory: infrastructure | |
args: --skip-path modules/dummy_resources | |
- name: GitLeaks Secret Scan | |
uses: zricethezav/[email protected] | |
with: | |
config_path: ../.gitleaks.toml | |
- name: Install Trivy | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget apt-transport-https gnupg lsb-release | |
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add - | |
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list | |
sudo apt-get update | |
sudo apt-get install -y trivy | |
- name: Run Trivy Scan | |
run: trivy filesystem --security-checks vuln,config --exit-code 1 --severity HIGH,CRITICAL --ignore-unfixed . |