chore: Refactor Snort installation script #47
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: Run Snort tests | |
on: [push, pull_request] | |
jobs: | |
run-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] # Operating systems | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Linux-specific steps | |
- name: Set up Python (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl gnupg2 iproute2 | |
pip install pytest pytest-testinfra | |
- name: Install wazuh-agent (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | sudo apt-key add - | |
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | sudo tee /etc/apt/sources.list.d/wazuh.list | |
sudo apt-get update | |
sudo apt-get install -y wazuh-agent | |
- name: Run Snort install script (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo bash scripts/install.sh | |
# Windows-specific steps | |
- name: Install Wazuh agent (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
Invoke-WebRequest -Uri https://packages.wazuh.com/4.x/windows/wazuh-agent-4.9.0-1.msi -OutFile $env:TEMP\wazuh-agent.msi | |
msiexec.exe /i $env:TEMP\wazuh-agent.msi /qn WAZUH_MANAGER='10.0.0.1' WAZUH_AGENT_NAME='test' | |
- name: Install Snort (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
Start-Process -FilePath "powershell.exe" -ArgumentList "-File $env:GITHUB_WORKSPACE/scripts/snort.ps1" -Verb RunAs -Wait | |
# Running tests | |
- name: Run tests (Linux) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo $(which pytest) -vv scripts/tests/test_linux.py | |
- name: List files (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
dir $env:GITHUB_WORKSPACE\scripts | |
- name: Run tests (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
pwsh -ExecutionPolicy Bypass -File $env:GITHUB_WORKSPACE/scripts/tests/test.ps1 |