Files
patterns/.github/workflows/nginx.yml
2025-01-07 18:56:11 +01:00

72 lines
1.8 KiB
YAML

name: Test Nginx Configuration
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test-nginx-config:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Install essential tools (bash, sudo, etc.)
- name: Install essential tools
run: |
sudo apt-get update
sudo apt-get install -y bash sudo python3-pip
# Step 3: Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
# Step 4: Install Python dependencies
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt # <-- Correct path to requirements.txt
# Step 5: Validate Python dependencies
- name: Validate Python dependencies
run: |
pip check
echo "Python dependencies validated successfully."
# Step 10: Install Nginx
- name: Install Nginx
run: |
sudo apt-get update
sudo apt-get install -y nginx
# Step 11: Validate Nginx installation
- name: Validate Nginx installation
run: |
nginx -v
echo "Nginx installed successfully."
# Create WAF dir
- name: Create waf directory
run: |
mkdir -p /etc/nginx/waf
chmod nginx:nginx /etc/nginx/waf
# Step 12: Import Nginx config
- name: Import Nginx config
run: python import_nginx_waf.py # <-- Correct script name
# Step 13: Validate Nginx configuration
- name: Validate Nginx configuration
run: |
sudo nginx -t -c /etc/nginx/nginx.conf
echo "Nginx configuration validated successfully."